debian-mirror-gitlab/spec/frontend/helpers/wait_using_real_timer.js

8 lines
223 B
JavaScript
Raw Permalink Normal View History

2020-07-28 23:09:34 +05:30
/* useful for timing promises when jest fakeTimers are not reliable enough */
export default timeout =>
new Promise(resolve => {
jest.useRealTimers();
setTimeout(resolve, timeout);
jest.useFakeTimers();
});