diff options
Diffstat (limited to 'spec/frontend/releases/components/app_index_spec.js')
-rw-r--r-- | spec/frontend/releases/components/app_index_spec.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/frontend/releases/components/app_index_spec.js b/spec/frontend/releases/components/app_index_spec.js index 0ffece36d90..1f485cb276e 100644 --- a/spec/frontend/releases/components/app_index_spec.js +++ b/spec/frontend/releases/components/app_index_spec.js @@ -20,6 +20,7 @@ localVue.use(Vuex); describe('Releases App ', () => { let wrapper; + let fetchReleaseSpy; const releasesPagination = rge(21).map(index => ({ ...convertObjectPropsToCamelCase(release, { deep: true }), @@ -28,12 +29,22 @@ describe('Releases App ', () => { const defaultProps = { projectId: 'gitlab-ce', + projectPath: 'gitlab-org/gitlab-ce', documentationPath: 'help/releases', illustrationPath: 'illustration/path', }; const createComponent = (propsData = defaultProps) => { - const store = createStore({ modules: { list: listModule } }); + fetchReleaseSpy = jest.spyOn(listModule.actions, 'fetchReleases'); + + const store = createStore({ + modules: { list: listModule }, + featureFlags: { + graphqlReleaseData: true, + graphqlReleasesPage: false, + graphqlMilestoneStats: true, + }, + }); wrapper = shallowMount(ReleasesApp, { store, @@ -46,6 +57,25 @@ describe('Releases App ', () => { wrapper.destroy(); }); + describe('on startup', () => { + beforeEach(() => { + jest + .spyOn(api, 'releases') + .mockResolvedValue({ data: releases, headers: pageInfoHeadersWithoutPagination }); + + createComponent(); + }); + + it('calls fetchRelease with the page, project ID, and project path', () => { + expect(fetchReleaseSpy).toHaveBeenCalledTimes(1); + expect(fetchReleaseSpy).toHaveBeenCalledWith(expect.anything(), { + page: null, + projectId: defaultProps.projectId, + projectPath: defaultProps.projectPath, + }); + }); + }); + describe('while loading', () => { beforeEach(() => { jest |