Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 56cb578

Browse files
committedApr 15, 2025·
feat: refactor tests
1 parent 9871944 commit 56cb578

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/courseware/course/sequence/sequence-navigation/UnitButton.test.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ describe('Unit Button', () => {
8383
expect(onClick).toHaveBeenCalledTimes(1);
8484
});
8585

86+
it('calls onClick with correct unitId when clicked', () => {
87+
const onClick = jest.fn();
88+
render(<UnitButton {...mockData} onClick={onClick} />, { wrapWithRouter: true });
89+
90+
fireEvent.click(screen.getByRole('tab'));
91+
92+
expect(onClick).toHaveBeenCalledWith(mockData.unitId);
93+
});
94+
8695
it('renders with no unitId and does not crash', async () => {
8796
render(<UnitButton unitId={undefined} onClick={jest.fn()} contentType="video" title="Unit" />, {
8897
wrapWithRouter: true,

0 commit comments

Comments
 (0)
Please sign in to comment.