diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/releases/stores/modules/list/mutations_spec.js | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/releases/stores/modules/list/mutations_spec.js')
-rw-r--r-- | spec/frontend/releases/stores/modules/list/mutations_spec.js | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/spec/frontend/releases/stores/modules/list/mutations_spec.js b/spec/frontend/releases/stores/modules/list/mutations_spec.js deleted file mode 100644 index 49e324c28a5..00000000000 --- a/spec/frontend/releases/stores/modules/list/mutations_spec.js +++ /dev/null @@ -1,81 +0,0 @@ -import originalRelease from 'test_fixtures/api/releases/release.json'; -import graphqlReleasesResponse from 'test_fixtures/graphql/releases/graphql/queries/all_releases.query.graphql.json'; -import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -import * as types from '~/releases/stores/modules/index/mutation_types'; -import mutations from '~/releases/stores/modules/index/mutations'; -import createState from '~/releases/stores/modules/index/state'; -import { convertAllReleasesGraphQLResponse } from '~/releases/util'; - -const originalReleases = [originalRelease]; - -describe('Releases Store Mutations', () => { - let stateCopy; - let pageInfo; - let releases; - - beforeEach(() => { - stateCopy = createState({}); - pageInfo = convertAllReleasesGraphQLResponse(graphqlReleasesResponse).paginationInfo; - releases = convertObjectPropsToCamelCase(originalReleases, { deep: true }); - }); - - describe('REQUEST_RELEASES', () => { - it('sets isLoading to true', () => { - mutations[types.REQUEST_RELEASES](stateCopy); - - expect(stateCopy.isLoading).toEqual(true); - }); - }); - - describe('RECEIVE_RELEASES_SUCCESS', () => { - beforeEach(() => { - mutations[types.RECEIVE_RELEASES_SUCCESS](stateCopy, { - pageInfo, - data: releases, - }); - }); - - it('sets is loading to false', () => { - expect(stateCopy.isLoading).toEqual(false); - }); - - it('sets hasError to false', () => { - expect(stateCopy.hasError).toEqual(false); - }); - - it('sets data', () => { - expect(stateCopy.releases).toEqual(releases); - }); - - it('sets pageInfo', () => { - expect(stateCopy.pageInfo).toEqual(pageInfo); - }); - }); - - describe('RECEIVE_RELEASES_ERROR', () => { - it('resets data', () => { - mutations[types.RECEIVE_RELEASES_SUCCESS](stateCopy, { - pageInfo, - data: releases, - }); - - mutations[types.RECEIVE_RELEASES_ERROR](stateCopy); - - expect(stateCopy.isLoading).toEqual(false); - expect(stateCopy.releases).toEqual([]); - expect(stateCopy.pageInfo).toEqual({}); - }); - }); - - describe('SET_SORTING', () => { - it('should merge the sorting object with sort value', () => { - mutations[types.SET_SORTING](stateCopy, { sort: 'asc' }); - expect(stateCopy.sorting).toEqual({ ...stateCopy.sorting, sort: 'asc' }); - }); - - it('should merge the sorting object with order_by value', () => { - mutations[types.SET_SORTING](stateCopy, { orderBy: 'created_at' }); - expect(stateCopy.sorting).toEqual({ ...stateCopy.sorting, orderBy: 'created_at' }); - }); - }); -}); |