diff options
Diffstat (limited to 'spec/frontend/droplab/plugins/ajax_spec.js')
-rw-r--r-- | spec/frontend/droplab/plugins/ajax_spec.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/spec/frontend/droplab/plugins/ajax_spec.js b/spec/frontend/droplab/plugins/ajax_spec.js deleted file mode 100644 index 7c6452e8337..00000000000 --- a/spec/frontend/droplab/plugins/ajax_spec.js +++ /dev/null @@ -1,41 +0,0 @@ -import Ajax from '~/droplab/plugins/ajax'; -import AjaxCache from '~/lib/utils/ajax_cache'; - -describe('Ajax', () => { - describe('preprocessing', () => { - const config = {}; - - describe('is not configured', () => { - it('passes the data through', () => { - const data = ['data']; - - expect(Ajax.preprocessing(config, data)).toEqual(data); - }); - }); - - describe('is configured', () => { - const processedArray = ['processed']; - - beforeEach(() => { - config.preprocessing = () => processedArray; - jest.spyOn(config, 'preprocessing').mockImplementation(() => processedArray); - }); - - it('calls preprocessing', () => { - Ajax.preprocessing(config, []); - - expect(config.preprocessing.mock.calls.length).toBe(1); - }); - - it('overrides AjaxCache', () => { - jest.spyOn(AjaxCache, 'override').mockImplementation((endpoint, results) => { - expect(results).toEqual(processedArray); - }); - - Ajax.preprocessing(config, []); - - expect(AjaxCache.override.mock.calls.length).toBe(1); - }); - }); - }); -}); |