diff options
Diffstat (limited to 'spec/frontend/__mocks__')
-rw-r--r-- | spec/frontend/__mocks__/@gitlab/ui.js | 10 | ||||
-rw-r--r-- | spec/frontend/__mocks__/lodash/debounce.js | 13 |
2 files changed, 21 insertions, 2 deletions
diff --git a/spec/frontend/__mocks__/@gitlab/ui.js b/spec/frontend/__mocks__/@gitlab/ui.js index ea36f1dabaf..237f8b408f5 100644 --- a/spec/frontend/__mocks__/@gitlab/ui.js +++ b/spec/frontend/__mocks__/@gitlab/ui.js @@ -18,8 +18,16 @@ jest.mock('@gitlab/ui/dist/directives/tooltip.js', () => ({ })); jest.mock('@gitlab/ui/dist/components/base/tooltip/tooltip.js', () => ({ + props: ['target', 'id', 'triggers', 'placement', 'container', 'boundary', 'disabled'], render(h) { - return h('div', this.$attrs, this.$slots.default); + return h( + 'div', + { + class: 'gl-tooltip', + ...this.$attrs, + }, + this.$slots.default, + ); }, })); diff --git a/spec/frontend/__mocks__/lodash/debounce.js b/spec/frontend/__mocks__/lodash/debounce.js index 97fdb39097a..e8b61c80147 100644 --- a/spec/frontend/__mocks__/lodash/debounce.js +++ b/spec/frontend/__mocks__/lodash/debounce.js @@ -8,4 +8,15 @@ // [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378 // Further reference: https://github.com/facebook/jest/issues/3465 -export default fn => fn; +export default fn => { + const debouncedFn = jest.fn().mockImplementation(fn); + debouncedFn.cancel = jest.fn(); + debouncedFn.flush = jest.fn().mockImplementation(() => { + const errorMessage = + "The .flush() method returned by lodash.debounce is not yet implemented/mocked by the mock in 'spec/frontend/__mocks__/lodash/debounce.js'."; + + throw new Error(errorMessage); + }); + + return debouncedFn; +}; |