diff options
Diffstat (limited to 'spec/javascripts/diffs')
-rw-r--r-- | spec/javascripts/diffs/components/app_spec.js | 8 | ||||
-rw-r--r-- | spec/javascripts/diffs/store/actions_spec.js | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/spec/javascripts/diffs/components/app_spec.js b/spec/javascripts/diffs/components/app_spec.js index b21cab58b4e..48e1ed18a2f 100644 --- a/spec/javascripts/diffs/components/app_spec.js +++ b/spec/javascripts/diffs/components/app_spec.js @@ -92,16 +92,16 @@ describe('diffs/components/app', () => { }); }); - it('calls fetchDiffFiles if diffsBatchLoad is enabled, and not latest version', () => { + it('calls batch methods if diffsBatchLoad is enabled, and not latest version', () => { wrapper.vm.glFeatures.diffsBatchLoad = true; wrapper.vm.isLatestVersion = () => false; wrapper.vm.fetchData(false); - expect(wrapper.vm.fetchDiffFiles).toHaveBeenCalled(); + expect(wrapper.vm.fetchDiffFiles).not.toHaveBeenCalled(); wrapper.vm.$nextTick(() => { expect(wrapper.vm.startRenderDiffsQueue).toHaveBeenCalled(); - expect(wrapper.vm.fetchDiffFilesMeta).not.toHaveBeenCalled(); - expect(wrapper.vm.fetchDiffFilesBatch).not.toHaveBeenCalled(); + expect(wrapper.vm.fetchDiffFilesMeta).toHaveBeenCalled(); + expect(wrapper.vm.fetchDiffFilesBatch).toHaveBeenCalled(); }); }); diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js index 589bd0e649a..b23334d38dc 100644 --- a/spec/javascripts/diffs/store/actions_spec.js +++ b/spec/javascripts/diffs/store/actions_spec.js @@ -147,13 +147,15 @@ describe('DiffsStoreActions', () => { describe('fetchDiffFilesBatch', () => { it('should fetch batch diff files', done => { const endpointBatch = '/fetch/diffs_batch'; - const batch1 = `${endpointBatch}?per_page=${DIFFS_PER_PAGE}`; - const batch2 = `${endpointBatch}?per_page=${DIFFS_PER_PAGE}&page=2`; const mock = new MockAdapter(axios); const res1 = { diff_files: [], pagination: { next_page: 2 } }; const res2 = { diff_files: [], pagination: {} }; - mock.onGet(batch1).reply(200, res1); - mock.onGet(batch2).reply(200, res2); + mock + .onGet(endpointBatch, { params: { page: undefined, per_page: DIFFS_PER_PAGE, w: '1' } }) + .reply(200, res1); + mock + .onGet(endpointBatch, { params: { page: 2, per_page: DIFFS_PER_PAGE, w: '1' } }) + .reply(200, res2); testAction( fetchDiffFilesBatch, |