-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added unit tests for progressScoreBar and noEntitiesFound component
- Loading branch information
Showing
4 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
import { test } from '@jest/globals'; | ||
import { describe } from '@jest/globals'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import NoEntitiesFound from './NoEntitiesFound'; | ||
|
||
describe('NoEntitiesFound tests', () => { | ||
it('should render correctly when there are no records', () => { | ||
|
||
// render | ||
render(<NoEntitiesFound />); | ||
|
||
// query | ||
|
||
const noInstanceText = screen.getByText('No suggested instance types found'); | ||
const gettingStartedButton = screen.getByRole('link'); | ||
|
||
// assert | ||
expect(noInstanceText).toBeVisible(); | ||
expect(gettingStartedButton).toBeVisible(); | ||
|
||
}); | ||
}); | ||
|
||
test.todo('NoEntitiesFound tests'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
import { test } from '@jest/globals'; | ||
import { describe } from '@jest/globals'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { ProgressScoreBar } from './ProgressScoreBar'; | ||
|
||
describe('ProgressScoreBar component tests', () => { | ||
it('expect to render with blue-300 class with 40%', () => { | ||
|
||
// render | ||
render(<ProgressScoreBar measureLocation='outside' eleId='345' utilizedValue={40} />); | ||
|
||
// query | ||
const progressScoreBar = screen.getByTestId('progress-score-bar'); | ||
const progressText40 = screen.getByText('40%'); | ||
|
||
// assert | ||
expect(progressScoreBar).toBeVisible(); | ||
expect(progressScoreBar).toHaveClass('pf-v5-c-progress blue-300'); | ||
expect(progressText40).toBeVisible(); | ||
|
||
}); | ||
|
||
it('expect to render with blue-300 class with 90%', () => { | ||
|
||
// render | ||
render(<ProgressScoreBar measureLocation='outside' utilizedValue={90} />); | ||
|
||
// query | ||
const progressScoreBar = screen.getByTestId('progress-score-bar'); | ||
const progressText90 = screen.getByText('90%'); | ||
|
||
// assert | ||
expect(progressScoreBar).toBeVisible(); | ||
expect(progressScoreBar).toHaveClass('pf-v5-c-progress blue-300'); | ||
expect(progressText90).toBeVisible(); | ||
|
||
}); | ||
}); | ||
|
||
test.todo('ProgressScoreBar component tests'); |