Skip to content

Commit

Permalink
update test to reduce coverage for find and comment action test undo
Browse files Browse the repository at this point in the history
  • Loading branch information
jesuyedavid committed May 14, 2024
1 parent 8d31233 commit 67b4a3f
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/components/SpellCheck.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@ describe('SpellCheck', () => {
expect(label).toEqual(mockedState.spellCheck?.correctedQuery);
});

// it('Fires onClick when provided', async () => {
// const props = {
// onClick: jest.fn()
// };
// const onClick = jest.spyOn(props, 'onClick');
// const actions = spyOnActions();
it('Fires onClick when provided', async () => {
const props = {
onClick: jest.fn()
};
const onClick = jest.spyOn(props, 'onClick');
const actions = spyOnActions();

// render(<SpellCheck {...props} />);
// await userEvent.click(screen.getByRole('button'));
render(<SpellCheck {...props} />);
await userEvent.click(screen.getByRole('button'));

// const verticalKey = mockedState.vertical?.verticalKey;
// const correctedQuery = mockedState.spellCheck?.correctedQuery;
// expect(actions.setQuery).toHaveBeenCalledWith(correctedQuery);
// expect(onClick).toHaveBeenCalledWith({ correctedQuery, verticalKey });
// });
const verticalKey = mockedState.vertical?.verticalKey;
const correctedQuery = mockedState.spellCheck?.correctedQuery;
expect(actions.setQuery).toHaveBeenCalledWith(correctedQuery);
expect(onClick).toHaveBeenCalledWith({ correctedQuery, verticalKey });
});

// it('Fires executeSearch when no onClick is provided', async () => {
// const actions = spyOnActions();
// render(<SpellCheck />);
// await userEvent.click(screen.getByRole('button'));
it('Fires executeSearch when no onClick is provided', async () => {
const actions = spyOnActions();
render(<SpellCheck />);
await userEvent.click(screen.getByRole('button'));

// const correctedQuery = mockedState.spellCheck?.correctedQuery;
// expect(actions.setQuery).toHaveBeenCalledWith(correctedQuery);
// expect(actions.executeVerticalQuery).toHaveBeenCalledTimes(1);
// });
const correctedQuery = mockedState.spellCheck?.correctedQuery;
expect(actions.setQuery).toHaveBeenCalledWith(correctedQuery);
expect(actions.executeVerticalQuery).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 67b4a3f

Please sign in to comment.