File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
products/statement-generator/src/__tests__ Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { render , screen } from '@testing-library/react' ;
3+ import '@testing-library/jest-dom' ;
4+ import ProgressBar from 'components/ProgressBar' ;
5+
6+ describe ( 'Progress Bar' , ( ) => {
7+ // tests that progress bar renders correctly
8+ test ( 'renders the progress bar component' , ( ) => {
9+ render ( < ProgressBar percentage = { 16.67 } /> ) ;
10+ const progressBarElement = screen . getByRole ( 'progressbar' ) ;
11+ expect ( progressBarElement ) . toBeInTheDocument ( ) ;
12+ } ) ;
13+
14+ // tests that progress bar renders the percentage that it's passed
15+ test ( 'progress bar displays the correct percentage' , ( ) => {
16+ render ( < ProgressBar percentage = { 50 } /> ) ;
17+ const progressBarElement = screen . getByRole ( 'progressbar' ) ;
18+ expect ( progressBarElement ) . toHaveAttribute ( 'aria-valuenow' , '50' ) ;
19+ } ) ;
20+
21+ // tests that progress bar renders the percentage its passed when completed
22+ test ( 'progress bar displays the correct max percentage' , ( ) => {
23+ render ( < ProgressBar percentage = { 100 } /> ) ;
24+ const progressBarElement = screen . getByRole ( 'progressbar' ) ;
25+ expect ( progressBarElement ) . toHaveAttribute ( 'aria-valuenow' , '100' ) ;
26+ } ) ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments