diff --git a/package.json b/package.json index ec81f55..7a7414d 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "server:ctr": "node src/server/generateServerKey.js", "start": "HOT=true fec dev", "test": "TZ=UTC jest --verbose --no-cache", - "test:local": "TZ=UTC jest --verbose --no-cache --coverage --coverageReporters='text-summary' --watch", + "test:local": "TZ=UTC jest --verbose --no-cache --coverage --coverageDirectory='coverage' --watch", "verify": "npm-run-all build lint test", "postinstall": "ts-patch install" }, diff --git a/src/Components/NoEntitiesFound/NoEntitiesFound.test.js b/src/Components/NoEntitiesFound/NoEntitiesFound.test.js index 29bb19a..42c85e9 100644 --- a/src/Components/NoEntitiesFound/NoEntitiesFound.test.js +++ b/src/Components/NoEntitiesFound/NoEntitiesFound.test.js @@ -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(); + + // 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'); diff --git a/src/Components/RosTable/ProgressScoreBar.js b/src/Components/RosTable/ProgressScoreBar.js index 0c1bb98..8ed98ea 100644 --- a/src/Components/RosTable/ProgressScoreBar.js +++ b/src/Components/RosTable/ProgressScoreBar.js @@ -8,7 +8,8 @@ export const ProgressScoreBar = ({ utilizedValue, measureLocation, eleId }) => + { ...(eleId ? { id: eleId } : null) } + data-testid='progress-score-bar' /> ); }; diff --git a/src/Components/RosTable/ProgressScoreBar.test.js b/src/Components/RosTable/ProgressScoreBar.test.js index 81b0350..11c4488 100644 --- a/src/Components/RosTable/ProgressScoreBar.test.js +++ b/src/Components/RosTable/ProgressScoreBar.test.js @@ -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(); + + // 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(); + + // 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');