diff options
| author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-06-07 14:45:57 -0500 |
|---|---|---|
| committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-06-07 14:45:57 -0500 |
| commit | 3ec37e2622f6729300a988c8f58dfb6c2aecb996 (patch) | |
| tree | d060b5acf30093cbe1d3642ea6dd11e79ccbf6c5 /spec/javascripts/lib | |
| parent | a65f07a256b95ce1c38342518f9469cbf3abf609 (diff) | |
| parent | fc1090d9f39231e31f929e37b9703db9738b457c (diff) | |
| download | gitlab-ce-3ec37e2622f6729300a988c8f58dfb6c2aecb996.tar.gz | |
Merge branch 'master' into 25426-group-dashboard-ui
Diffstat (limited to 'spec/javascripts/lib')
| -rw-r--r-- | spec/javascripts/lib/utils/ajax_cache_spec.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/ajax_cache_spec.js b/spec/javascripts/lib/utils/ajax_cache_spec.js index e1747a82329..2c946802dcd 100644 --- a/spec/javascripts/lib/utils/ajax_cache_spec.js +++ b/spec/javascripts/lib/utils/ajax_cache_spec.js @@ -154,5 +154,36 @@ describe('AjaxCache', () => { .then(done) .catch(fail); }); + + it('makes Ajax call even if matching data exists when forceRequest parameter is provided', (done) => { + const oldDummyResponse = { + important: 'old dummy data', + }; + + AjaxCache.internalStorage[dummyEndpoint] = oldDummyResponse; + + ajaxSpy = (url) => { + expect(url).toBe(dummyEndpoint); + const deferred = $.Deferred(); + deferred.resolve(dummyResponse); + return deferred.promise(); + }; + + // Call without forceRetrieve param + AjaxCache.retrieve(dummyEndpoint) + .then((data) => { + expect(data).toBe(oldDummyResponse); + }) + .then(done) + .catch(fail); + + // Call with forceRetrieve param + AjaxCache.retrieve(dummyEndpoint, true) + .then((data) => { + expect(data).toBe(dummyResponse); + }) + .then(done) + .catch(fail); + }); }); }); |
