forked from thoughtworks/HeartBeat
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend]ADM-728: extra const and change type for placement (#957)
* ADM-728 [frontend] refactor: extra const and change type for Placement * ADM-728 [frontend] refactor: use const from fixtures * ADM-728 [frontend] refactor: add onBack function * ADM-728 [frontend] refactor: rename
- Loading branch information
Showing
6 changed files
with
32 additions
and
36 deletions.
There are no files selected for viewing
18 changes: 7 additions & 11 deletions
18
frontend/__tests__/src/components/Common/ReportForThreeColumns.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import ReportForThreeColumns from '@src/components/Common/ReportForThreeColumns'; | ||
import clearAllMocks = jest.clearAllMocks; | ||
import { LOADING, VELOCITY } from '../../fixtures'; | ||
|
||
describe('Report for three columns', () => { | ||
afterEach(() => { | ||
clearAllMocks(); | ||
}); | ||
|
||
it('should show loading when data is empty', () => { | ||
render(<ReportForThreeColumns title='title' fieldName='fieldName' listName='listName' data={undefined} />); | ||
render(<ReportForThreeColumns title={VELOCITY} fieldName='fieldName' listName='listName' data={null} />); | ||
|
||
expect(screen.getByTestId('loading')).toBeInTheDocument(); | ||
expect(screen.getByText('title')).toBeInTheDocument(); | ||
expect(screen.getByTestId(LOADING)).toBeInTheDocument(); | ||
expect(screen.getByText(VELOCITY)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should show table when has data', () => { | ||
it('should show table when data is not empty', () => { | ||
const mockData = [ | ||
{ id: 0, name: 'name1', valuesList: [{ name: 'test1', value: '1' }] }, | ||
{ id: 1, name: 'name2', valuesList: [{ name: 'test2', value: '2' }] }, | ||
{ id: 2, name: 'name3', valuesList: [{ name: 'test3', value: '3' }] }, | ||
]; | ||
|
||
render(<ReportForThreeColumns title='title' fieldName='fieldName' listName='listName' data={mockData} />); | ||
render(<ReportForThreeColumns title={VELOCITY} fieldName='fieldName' listName='listName' data={mockData} />); | ||
|
||
expect(screen.getByTestId('title')).toBeInTheDocument(); | ||
expect(screen.getByTestId(VELOCITY)).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters