diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/vue_shared/plugins/global_toast_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/plugins/global_toast_spec.js b/spec/frontend/vue_shared/plugins/global_toast_spec.js new file mode 100644 index 00000000000..551abe3cb41 --- /dev/null +++ b/spec/frontend/vue_shared/plugins/global_toast_spec.js @@ -0,0 +1,24 @@ +import toast from '~/vue_shared/plugins/global_toast'; +import Vue from 'vue'; + +describe('Global toast', () => { + let spyFunc; + + beforeEach(() => { + spyFunc = jest.spyOn(Vue.toasted, 'show').mockImplementation(() => {}); + }); + + afterEach(() => { + spyFunc.mockRestore(); + }); + + it('should pass all args to Vue toasted', () => { + const arg1 = 'TestMessage'; + const arg2 = { className: 'foo' }; + + toast(arg1, arg2); + + expect(Vue.toasted.show).toHaveBeenCalledTimes(1); + expect(Vue.toasted.show).toHaveBeenCalledWith(arg1, arg2); + }); +}); |