Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1662

Merged
merged 5 commits into from
Jan 6, 2025
Merged

Dev #1662

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
progress bar testing
whitneywind committed Nov 8, 2024
commit 6f9aeb5cdc13b95e6e46f8bc7d50764fa7202234
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');
});
});