diff options
author | Natalia Tepluhina <ntepluhina@gitlab.com> | 2019-04-23 07:42:58 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-04-23 07:42:58 +0000 |
commit | 7dc2a7aa5bb53144ef1ecfeaeec5f10c70ede3fe (patch) | |
tree | 160d7fc7c117081e985825c8b7075fb562011de0 /spec/javascripts | |
parent | 712a63a7455af7e4663aea3862aa491b439d0f96 (diff) | |
download | gitlab-ce-7dc2a7aa5bb53144ef1ecfeaeec5f10c70ede3fe.tar.gz |
Revert "Increased page size to 100"
This reverts commit 2869a61f3b7aeb8b6d79c74332c93e32cec20caa.
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/ide/stores/modules/file_templates/actions_spec.js | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/spec/javascripts/ide/stores/modules/file_templates/actions_spec.js b/spec/javascripts/ide/stores/modules/file_templates/actions_spec.js index 734233100ab..548962c7a92 100644 --- a/spec/javascripts/ide/stores/modules/file_templates/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/file_templates/actions_spec.js @@ -69,18 +69,16 @@ describe('IDE file templates actions', () => { describe('fetchTemplateTypes', () => { describe('success', () => { - let nextPage; + const pages = [[{ name: 'MIT' }], [{ name: 'Apache' }], [{ name: 'CC' }]]; beforeEach(() => { - mock.onGet(/api\/(.*)\/templates\/licenses/).replyOnce(() => [ - 200, - [ - { - name: 'MIT', - }, - ], - { 'X-NEXT-PAGE': nextPage }, - ]); + mock.onGet(/api\/(.*)\/templates\/licenses/).reply(({ params }) => { + const pageNum = params.page; + const page = pages[pageNum - 1]; + const hasNextPage = pageNum < pages.length; + + return [200, page, hasNextPage ? { 'X-NEXT-PAGE': pageNum + 1 } : {}]; + }); }); it('rejects if selectedTemplateType is empty', done => { @@ -112,43 +110,15 @@ describe('IDE file templates actions', () => { }, { type: 'receiveTemplateTypesSuccess', - payload: [ - { - name: 'MIT', - }, - ], - }, - ], - done, - ); - }); - - it('dispatches actions for next page', done => { - nextPage = '2'; - state.selectedTemplateType = { - key: 'licenses', - }; - - testAction( - actions.fetchTemplateTypes, - null, - state, - [], - [ - { - type: 'requestTemplateTypes', + payload: pages[0], }, { type: 'receiveTemplateTypesSuccess', - payload: [ - { - name: 'MIT', - }, - ], + payload: pages[0].concat(pages[1]), }, { - type: 'fetchTemplateTypes', - payload: 2, + type: 'receiveTemplateTypesSuccess', + payload: pages[0].concat(pages[1]).concat(pages[2]), }, ], done, |