Skip to content

Commit

Permalink
test: improve test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpastor committed Mar 10, 2024
1 parent d4cbf2f commit 51a7ceb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/hooks/use-number.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ describe("useNumber", (): void => {
expect(result.current.value).toEqual(initialValue);
});

it("should update the value", (): void => {
const { result, rerender } = renderHook(
({ value }): NumberUtilities => useNumber(value),
{
initialProps: {
value: 0
}
}
);

expect(result.current.value).toBe(0);

rerender({ value: 1 });

expect(result.current.value).toBe(1);
});

it("should set value", (): void => {
const initialValue: number = 0;
const { result, rerender } = renderHook((): NumberUtilities => useNumber(initialValue));
Expand Down

0 comments on commit 51a7ceb

Please sign in to comment.