UNPKG

label-studio

Version:

Data Labeling Tool that is backend agnostic and can be embedded into your applications

24 lines (17 loc) 403 B
import { debounce } from "../debounce"; jest.useFakeTimers(); describe("Debounce function", () => { let func; let debouncedFunc; beforeEach(() => { func = jest.fn(); debouncedFunc = debounce(func, 1000); }); test("Execute just once", () => { for (let i = 0; i < 100; i++) { debouncedFunc(); } jest.runAllTimers(); expect(func).toBeCalledTimes(1); }); });