Skip to content

Commit

Permalink
Use expect.anything() in tests to also tests all arguments received i…
Browse files Browse the repository at this point in the history
…n useInfuser
  • Loading branch information
Ayc0 committed Jul 30, 2023
1 parent 1e5d419 commit 6191dee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-manatea/__tests__/useInfuser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ describe('useInfuser', () => {
expect(result.current[0]).toBe(0);

const fn = jest.fn();
cup.on(tea => fn(tea));
cup.on(fn);

await act(async () => {
await result.current[1]('1');
});
expect(cup()).toBe(1);
expect(fn).toHaveBeenCalledWith(1);
expect(fn).toHaveBeenCalledWith(1, expect.anything());

await act(async () => {
await result.current[1]('2');
});
expect(cup()).toBe(3);
expect(fn).toHaveBeenCalledWith(3);
expect(fn).toHaveBeenCalledWith(3, expect.anything());
});

it('should work with derived cups', async () => {
Expand Down

0 comments on commit 6191dee

Please sign in to comment.