Skip to content

Commit

Permalink
chore(sonar): no-magic-number
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandatoledo committed Jul 26, 2024
1 parent 0b0d688 commit 85701d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ui/progress-bar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('ProgressBar component', () => {
});

it('setProgress function works correctly', async () => {
const finalValue = 75;
const progressAnimationDuration = 250;
const ref = createRef<ProgressBarRef>();
render(<ProgressBar ref={ref} initialProgress={0} />);
const progressBar = screen.getByTestId(PROGRESS_BAR);
Expand All @@ -30,11 +32,11 @@ describe('ProgressBar component', () => {
if (ref.current) {
expect(getAnimatedStyle(progressBar)).toMatchObject({ width: '0%' });
jest.useFakeTimers();
ref.current.setProgress(75);
jest.advanceTimersByTime(250); // Duration of the animation
ref.current.setProgress(finalValue);
jest.advanceTimersByTime(progressAnimationDuration); // Duration of the animation
const updatedProgressBar = await screen.findByTestId(PROGRESS_BAR);
expect(getAnimatedStyle(updatedProgressBar)).toMatchObject({
width: '75%',
width: `${finalValue}%`,
});
}
});
Expand Down

0 comments on commit 85701d1

Please sign in to comment.