Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/releases/stores/modules/list')
-rw-r--r--spec/javascripts/releases/stores/modules/list/actions_spec.js131
-rw-r--r--spec/javascripts/releases/stores/modules/list/helpers.js6
-rw-r--r--spec/javascripts/releases/stores/modules/list/mutations_spec.js55
3 files changed, 0 insertions, 192 deletions
diff --git a/spec/javascripts/releases/stores/modules/list/actions_spec.js b/spec/javascripts/releases/stores/modules/list/actions_spec.js
deleted file mode 100644
index bf85e18997b..00000000000
--- a/spec/javascripts/releases/stores/modules/list/actions_spec.js
+++ /dev/null
@@ -1,131 +0,0 @@
-import testAction from 'spec/helpers/vuex_action_helper';
-import {
- requestReleases,
- fetchReleases,
- receiveReleasesSuccess,
- receiveReleasesError,
-} from '~/releases/stores/modules/list/actions';
-import state from '~/releases/stores/modules/list/state';
-import * as types from '~/releases/stores/modules/list/mutation_types';
-import api from '~/api';
-import { parseIntPagination, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
-import { pageInfoHeadersWithoutPagination, releases as originalReleases } from '../../../mock_data';
-
-describe('Releases State actions', () => {
- let mockedState;
- let pageInfo;
- let releases;
-
- beforeEach(() => {
- mockedState = state();
- pageInfo = parseIntPagination(pageInfoHeadersWithoutPagination);
- releases = convertObjectPropsToCamelCase(originalReleases, { deep: true });
- });
-
- describe('requestReleases', () => {
- it('should commit REQUEST_RELEASES mutation', done => {
- testAction(requestReleases, null, mockedState, [{ type: types.REQUEST_RELEASES }], [], done);
- });
- });
-
- describe('fetchReleases', () => {
- describe('success', () => {
- it('dispatches requestReleases and receiveReleasesSuccess', done => {
- spyOn(api, 'releases').and.callFake((id, options) => {
- expect(id).toEqual(1);
- expect(options.page).toEqual('1');
- return Promise.resolve({ data: releases, headers: pageInfoHeadersWithoutPagination });
- });
-
- testAction(
- fetchReleases,
- { projectId: 1 },
- mockedState,
- [],
- [
- {
- type: 'requestReleases',
- },
- {
- payload: { data: releases, headers: pageInfoHeadersWithoutPagination },
- type: 'receiveReleasesSuccess',
- },
- ],
- done,
- );
- });
-
- it('dispatches requestReleases and receiveReleasesSuccess on page two', done => {
- spyOn(api, 'releases').and.callFake((_, options) => {
- expect(options.page).toEqual('2');
- return Promise.resolve({ data: releases, headers: pageInfoHeadersWithoutPagination });
- });
-
- testAction(
- fetchReleases,
- { page: '2', projectId: 1 },
- mockedState,
- [],
- [
- {
- type: 'requestReleases',
- },
- {
- payload: { data: releases, headers: pageInfoHeadersWithoutPagination },
- type: 'receiveReleasesSuccess',
- },
- ],
- done,
- );
- });
- });
-
- describe('error', () => {
- it('dispatches requestReleases and receiveReleasesError', done => {
- spyOn(api, 'releases').and.returnValue(Promise.reject());
-
- testAction(
- fetchReleases,
- { projectId: null },
- mockedState,
- [],
- [
- {
- type: 'requestReleases',
- },
- {
- type: 'receiveReleasesError',
- },
- ],
- done,
- );
- });
- });
- });
-
- describe('receiveReleasesSuccess', () => {
- it('should commit RECEIVE_RELEASES_SUCCESS mutation', done => {
- testAction(
- receiveReleasesSuccess,
- { data: releases, headers: pageInfoHeadersWithoutPagination },
- mockedState,
- [{ type: types.RECEIVE_RELEASES_SUCCESS, payload: { pageInfo, data: releases } }],
- [],
- done,
- );
- });
- });
-
- describe('receiveReleasesError', () => {
- it('should commit RECEIVE_RELEASES_ERROR mutation', done => {
- testAction(
- receiveReleasesError,
- null,
- mockedState,
- [{ type: types.RECEIVE_RELEASES_ERROR }],
- [],
- done,
- );
- });
- });
-});
diff --git a/spec/javascripts/releases/stores/modules/list/helpers.js b/spec/javascripts/releases/stores/modules/list/helpers.js
deleted file mode 100644
index 435ca36047e..00000000000
--- a/spec/javascripts/releases/stores/modules/list/helpers.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import state from '~/releases/stores/modules/list/state';
-
-// eslint-disable-next-line import/prefer-default-export
-export const resetStore = store => {
- store.replaceState(state());
-};
diff --git a/spec/javascripts/releases/stores/modules/list/mutations_spec.js b/spec/javascripts/releases/stores/modules/list/mutations_spec.js
deleted file mode 100644
index 3035b916ff6..00000000000
--- a/spec/javascripts/releases/stores/modules/list/mutations_spec.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import state from '~/releases/stores/modules/list/state';
-import mutations from '~/releases/stores/modules/list/mutations';
-import * as types from '~/releases/stores/modules/list/mutation_types';
-import { parseIntPagination } from '~/lib/utils/common_utils';
-import { pageInfoHeadersWithoutPagination, releases } from '../../../mock_data';
-
-describe('Releases Store Mutations', () => {
- let stateCopy;
- let pageInfo;
-
- beforeEach(() => {
- stateCopy = state();
- pageInfo = parseIntPagination(pageInfoHeadersWithoutPagination);
- });
-
- 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_ERROR](stateCopy);
-
- expect(stateCopy.isLoading).toEqual(false);
- expect(stateCopy.releases).toEqual([]);
- expect(stateCopy.pageInfo).toEqual({});
- });
- });
-});