diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-08-02 09:27:24 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-08-02 09:27:24 +0000 |
commit | 974a04026dd1043981c25e64c9827c3b8d15a927 (patch) | |
tree | 6911de2ce71ee949e224b593e5c8b693c4dd0eda /spec/javascripts/droplab | |
parent | 6f66b19b939560a94cd2e89d94f203948ca2f2fb (diff) | |
download | gitlab-ce-974a04026dd1043981c25e64c9827c3b8d15a927.tar.gz |
Add filtered search to group issue dashboard
Diffstat (limited to 'spec/javascripts/droplab')
-rw-r--r-- | spec/javascripts/droplab/plugins/ajax_spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/droplab/plugins/ajax_spec.js b/spec/javascripts/droplab/plugins/ajax_spec.js new file mode 100644 index 00000000000..085f25764fe --- /dev/null +++ b/spec/javascripts/droplab/plugins/ajax_spec.js @@ -0,0 +1,36 @@ +import AjaxCache from '~/lib/utils/ajax_cache'; +import Ajax from '~/droplab/plugins/ajax'; + +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; + spyOn(config, 'preprocessing').and.callFake(() => processedArray); + }); + + it('calls preprocessing', () => { + Ajax.preprocessing(config, []); + expect(config.preprocessing.calls.count()).toBe(1); + }); + + it('overrides AjaxCache', () => { + spyOn(AjaxCache, 'override').and.callFake((endpoint, results) => expect(results).toEqual(processedArray)); + + Ajax.preprocessing(config, []); + expect(AjaxCache.override.calls.count()).toBe(1); + }); + }); + }); +}); |