-
Notifications
You must be signed in to change notification settings - Fork 442
Open
Labels
triageNew issues that needs considerationNew issues that needs consideration
Description
Is there a way to use fakeTimers in sandpack's tests component?
Currently I am forced to use realTimers. It works but it takes a long time to see the tests results ( because of real timers ofcourse ). The way I am writing tests is using a "wait" utility
import { debounce } from "./index";
function wait(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
describe("Debounce Function", () => {
it("should not be invoked immediately", async () => {
const originalFunction1 = jest.fn();
const debouncedFunction1 = debounce(originalFunction1, 300);
debouncedFunction1();
expect(originalFunction1).not.toBeCalled();
});
});
Is there a better way?
Metadata
Metadata
Assignees
Labels
triageNew issues that needs considerationNew issues that needs consideration