Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/helpers/backoff_helper.js')
-rw-r--r--spec/frontend/helpers/backoff_helper.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/spec/frontend/helpers/backoff_helper.js b/spec/frontend/helpers/backoff_helper.js
deleted file mode 100644
index e5c0308d3fb..00000000000
--- a/spec/frontend/helpers/backoff_helper.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * A mock version of a commonUtils `backOff` to test multiple
- * retries.
- *
- * Usage:
- *
- * ```
- * import * as commonUtils from '~/lib/utils/common_utils';
- * import { backoffMockImplementation } from '../../helpers/backoff_helper';
- *
- * beforeEach(() => {
- * // ...
- * jest.spyOn(commonUtils, 'backOff').mockImplementation(backoffMockImplementation);
- * });
- * ```
- *
- * @param {Function} callback
- */
-export const backoffMockImplementation = callback => {
- const q = new Promise((resolve, reject) => {
- const stop = arg => (arg instanceof Error ? reject(arg) : resolve(arg));
- const next = () => callback(next, stop);
- // Define a timeout based on a mock timer
- setTimeout(() => {
- callback(next, stop);
- });
- });
- // Run all resolved promises in chain
- jest.runOnlyPendingTimers();
- return q;
-};
-
-export default { backoffMockImplementation };