diff --git a/packages/react/react/src/hooks/useInterval.spec.tsx b/packages/react/react/src/hooks/useInterval.spec.tsx index 3693bbfcd..88b43b71c 100644 --- a/packages/react/react/src/hooks/useInterval.spec.tsx +++ b/packages/react/react/src/hooks/useInterval.spec.tsx @@ -4,7 +4,7 @@ import { useInterval } from './useInterval'; jest.useFakeTimers(); describe('useInterval', () => { - it('정해진 시간이 지날때마다, 콜백을 실행한다', () => { + it('Should execute a callback every time a set time passes.', () => { const callback = jest.fn(); renderHook(() => @@ -26,7 +26,7 @@ describe('useInterval', () => { expect(callback).toBeCalledTimes(2); }); - it('number option도 동일하게실행한다', () => { + it('should work the same with number options as well.', () => { const callback = jest.fn(); renderHook(() => useInterval(callback, 3000)); @@ -43,4 +43,22 @@ describe('useInterval', () => { expect(callback).toBeCalledTimes(2); }); + + it('Should not set the interval when delay is null.', () => { + const callback = jest.fn(); + + renderHook(() => useInterval(callback, { delay: null })); + + jest.advanceTimersByTime(3000); + + expect(callback).not.toBeCalled(); + }); + + it('Should execute the callback immediately when the trailing option is false.', () => { + const callback = jest.fn(); + + renderHook(() => useInterval(callback, { delay: 3000, trailing: false })); + + expect(callback).toBeCalledTimes(1); + }); });