Skip to content

Commit ad5e3c5

Browse files
authored
Merge pull request #22 from oslabs-beta/action-testing
Make action tests more robust
2 parents 0d0e8fd + a756755 commit ad5e3c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/app/__tests__/action.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ describe('unit testing for Action.tsx', () => {
8787
test('Clicking the snapshot should trigger onClick', () => {
8888
render(<Action {...props} />);
8989
fireEvent.click(screen.getByRole('presentation'));
90-
expect(props.dispatch).toHaveBeenCalledWith(changeView(2));;
90+
expect(props.dispatch).toHaveBeenCalledWith(changeView(props.index));;
9191
});
9292

9393
test('Clicking Jump button should trigger changeSlider and changeView', () => {
9494
render(<Action {...props} />);
9595
fireEvent.click(screen.getAllByRole('button')[1]);
96-
expect(props.dispatch).toHaveBeenCalledWith(changeSlider(2));
97-
expect(props.dispatch).toHaveBeenCalledWith(changeView(2));
96+
expect(props.dispatch).toHaveBeenCalledWith(changeSlider(props.index));
97+
expect(props.dispatch).toHaveBeenCalledWith(changeView(props.index));
9898
});
9999
});
100100
});

0 commit comments

Comments
 (0)