Skip to content

imsarvesh/clipboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 

Repository files navigation

test('should call the callback after 1 min', () => { jest.useFakeTimers()

const delay = 60000
const callback = jest.fn()

renderHook(() => useTimeout(callback, delay))

expect(callback).not.toHaveBeenCalled()

act(() => {
  jest.advanceTimersByTime(delay)
})

expect(callback).toHaveBeenCalledTimes(1)

})

test('should not do anything if "delay" is null', () => { jest.useFakeTimers()

const delay = null
const callback = jest.fn()

renderHook(() => useTimeout(callback, delay))

expect(callback).not.toHaveBeenCalled()

act(() => {
  jest.runAllTimers()
})

expect(callback).not.toHaveBeenCalled()

})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published