diff options
Diffstat (limited to 'spec/frontend/__mocks__/lodash')
-rw-r--r-- | spec/frontend/__mocks__/lodash/debounce.js | 2 | ||||
-rw-r--r-- | spec/frontend/__mocks__/lodash/defer.js | 5 | ||||
-rw-r--r-- | spec/frontend/__mocks__/lodash/throttle.js | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/spec/frontend/__mocks__/lodash/debounce.js b/spec/frontend/__mocks__/lodash/debounce.js index e8b61c80147..d4fe2ce5406 100644 --- a/spec/frontend/__mocks__/lodash/debounce.js +++ b/spec/frontend/__mocks__/lodash/debounce.js @@ -8,7 +8,7 @@ // [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378 // Further reference: https://github.com/facebook/jest/issues/3465 -export default fn => { +export default (fn) => { const debouncedFn = jest.fn().mockImplementation(fn); debouncedFn.cancel = jest.fn(); debouncedFn.flush = jest.fn().mockImplementation(() => { diff --git a/spec/frontend/__mocks__/lodash/defer.js b/spec/frontend/__mocks__/lodash/defer.js new file mode 100644 index 00000000000..9325cb28ba6 --- /dev/null +++ b/spec/frontend/__mocks__/lodash/defer.js @@ -0,0 +1,5 @@ +/** + * Instead of messing around with timers, we execute deferred functions + * immediately in our specs + */ +export default (fn, ...args) => fn(...args); diff --git a/spec/frontend/__mocks__/lodash/throttle.js b/spec/frontend/__mocks__/lodash/throttle.js index aef391afd0c..e8a82654c78 100644 --- a/spec/frontend/__mocks__/lodash/throttle.js +++ b/spec/frontend/__mocks__/lodash/throttle.js @@ -1,4 +1,4 @@ // Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs. // See `./debounce.js` for more details. -export default fn => fn; +export default (fn) => fn; |