generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1644 from hackforla/progress-bar-tests-1246
fixes #1246 progress bar testing
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
products/statement-generator/src/__tests__/progressbar.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import ProgressBar from 'components/ProgressBar'; | ||
|
||
describe('Progress Bar', () => { | ||
// tests that progress bar renders correctly | ||
test('renders the progress bar component', () => { | ||
render(<ProgressBar percentage={16.67} />); | ||
const progressBarElement = screen.getByRole('progressbar'); | ||
expect(progressBarElement).toBeInTheDocument(); | ||
}); | ||
|
||
// tests that progress bar renders the percentage that it's passed | ||
test('progress bar displays the correct percentage', () => { | ||
render(<ProgressBar percentage={50} />); | ||
const progressBarElement = screen.getByRole('progressbar'); | ||
expect(progressBarElement).toHaveAttribute('aria-valuenow', '50'); | ||
}); | ||
|
||
// tests that progress bar renders the percentage its passed when completed | ||
test('progress bar displays the correct max percentage', () => { | ||
render(<ProgressBar percentage={100} />); | ||
const progressBarElement = screen.getByRole('progressbar'); | ||
expect(progressBarElement).toHaveAttribute('aria-valuenow', '100'); | ||
}); | ||
}); |