Skip to content

Commit

Permalink
Merge pull request #1644 from hackforla/progress-bar-tests-1246
Browse files Browse the repository at this point in the history
fixes #1246 progress bar testing
  • Loading branch information
sydneywalcoff authored Jan 6, 2025
2 parents af4b3f9 + 6f9aeb5 commit 46a9f7a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions products/statement-generator/src/__tests__/progressbar.test.tsx
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');
});
});

0 comments on commit 46a9f7a

Please sign in to comment.