debian-mirror-gitlab/spec/frontend/helpers/wait_using_real_timer.js
2020-08-09 17:41:57 +05:30

7 lines
223 B
JavaScript

/* useful for timing promises when jest fakeTimers are not reliable enough */
export default timeout =>
new Promise(resolve => {
jest.useRealTimers();
setTimeout(resolve, timeout);
jest.useFakeTimers();
});