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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-12 09:09:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-12 09:09:37 +0300
commit143f7be045960f8d51dea738781535d614956f84 (patch)
tree9d0a79240567a6c94f64bc7bfcfa834fce9f2ac6 /spec/javascripts
parent0e30d318bbe0e9e94885f865db3372e758c512bb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vue_mr_widget/stores/artifacts_list/actions_spec.js165
-rw-r--r--spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js112
2 files changed, 0 insertions, 277 deletions
diff --git a/spec/javascripts/vue_mr_widget/stores/artifacts_list/actions_spec.js b/spec/javascripts/vue_mr_widget/stores/artifacts_list/actions_spec.js
deleted file mode 100644
index 5070e74b5d2..00000000000
--- a/spec/javascripts/vue_mr_widget/stores/artifacts_list/actions_spec.js
+++ /dev/null
@@ -1,165 +0,0 @@
-import MockAdapter from 'axios-mock-adapter';
-import testAction from 'spec/helpers/vuex_action_helper';
-import { TEST_HOST } from 'spec/test_constants';
-import axios from '~/lib/utils/axios_utils';
-import {
- setEndpoint,
- requestArtifacts,
- clearEtagPoll,
- stopPolling,
- fetchArtifacts,
- receiveArtifactsSuccess,
- receiveArtifactsError,
-} from '~/vue_merge_request_widget/stores/artifacts_list/actions';
-import state from '~/vue_merge_request_widget/stores/artifacts_list/state';
-import * as types from '~/vue_merge_request_widget/stores/artifacts_list/mutation_types';
-
-describe('Artifacts App Store Actions', () => {
- let mockedState;
-
- beforeEach(() => {
- mockedState = state();
- });
-
- describe('setEndpoint', () => {
- it('should commit SET_ENDPOINT mutation', done => {
- testAction(
- setEndpoint,
- 'endpoint.json',
- mockedState,
- [{ type: types.SET_ENDPOINT, payload: 'endpoint.json' }],
- [],
- done,
- );
- });
- });
-
- describe('requestArtifacts', () => {
- it('should commit REQUEST_ARTIFACTS mutation', done => {
- testAction(
- requestArtifacts,
- null,
- mockedState,
- [{ type: types.REQUEST_ARTIFACTS }],
- [],
- done,
- );
- });
- });
-
- describe('fetchArtifacts', () => {
- let mock;
-
- beforeEach(() => {
- mockedState.endpoint = `${TEST_HOST}/endpoint.json`;
- mock = new MockAdapter(axios);
- });
-
- afterEach(() => {
- mock.restore();
- stopPolling();
- clearEtagPoll();
- });
-
- describe('success', () => {
- it('dispatches requestArtifacts and receiveArtifactsSuccess ', done => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, [
- {
- text: 'result.txt',
- url: 'asda',
- job_name: 'generate-artifact',
- job_path: 'asda',
- },
- ]);
-
- testAction(
- fetchArtifacts,
- null,
- mockedState,
- [],
- [
- {
- type: 'requestArtifacts',
- },
- {
- payload: {
- data: [
- {
- text: 'result.txt',
- url: 'asda',
- job_name: 'generate-artifact',
- job_path: 'asda',
- },
- ],
- status: 200,
- },
- type: 'receiveArtifactsSuccess',
- },
- ],
- done,
- );
- });
- });
-
- describe('error', () => {
- beforeEach(() => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
- });
-
- it('dispatches requestArtifacts and receiveArtifactsError ', done => {
- testAction(
- fetchArtifacts,
- null,
- mockedState,
- [],
- [
- {
- type: 'requestArtifacts',
- },
- {
- type: 'receiveArtifactsError',
- },
- ],
- done,
- );
- });
- });
- });
-
- describe('receiveArtifactsSuccess', () => {
- it('should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200', done => {
- testAction(
- receiveArtifactsSuccess,
- { data: { summary: {} }, status: 200 },
- mockedState,
- [{ type: types.RECEIVE_ARTIFACTS_SUCCESS, payload: { summary: {} } }],
- [],
- done,
- );
- });
-
- it('should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204', done => {
- testAction(
- receiveArtifactsSuccess,
- { data: { summary: {} }, status: 204 },
- mockedState,
- [],
- [],
- done,
- );
- });
- });
-
- describe('receiveArtifactsError', () => {
- it('should commit RECEIVE_ARTIFACTS_ERROR mutation', done => {
- testAction(
- receiveArtifactsError,
- null,
- mockedState,
- [{ type: types.RECEIVE_ARTIFACTS_ERROR }],
- [],
- done,
- );
- });
- });
-});
diff --git a/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js b/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
deleted file mode 100644
index 1906585af7b..00000000000
--- a/spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
+++ /dev/null
@@ -1,112 +0,0 @@
-import MergeRequestStore from '~/vue_merge_request_widget/stores/mr_widget_store';
-import { stateKey } from '~/vue_merge_request_widget/stores/state_maps';
-import mockData from '../mock_data';
-
-describe('MergeRequestStore', () => {
- let store;
-
- beforeEach(() => {
- store = new MergeRequestStore(mockData);
- });
-
- describe('setData', () => {
- it('should set isSHAMismatch when the diff SHA changes', () => {
- store.setData({ ...mockData, diff_head_sha: 'a-different-string' });
-
- expect(store.isSHAMismatch).toBe(true);
- });
-
- it('should not set isSHAMismatch when other data changes', () => {
- store.setData({ ...mockData, work_in_progress: !mockData.work_in_progress });
-
- expect(store.isSHAMismatch).toBe(false);
- });
-
- it('should update cached sha after rebasing', () => {
- store.setData({ ...mockData, diff_head_sha: 'abc123' }, true);
-
- expect(store.isSHAMismatch).toBe(false);
- expect(store.sha).toBe('abc123');
- });
-
- describe('isPipelinePassing', () => {
- it('is true when the CI status is `success`', () => {
- store.setData({ ...mockData, ci_status: 'success' });
-
- expect(store.isPipelinePassing).toBe(true);
- });
-
- it('is true when the CI status is `success-with-warnings`', () => {
- store.setData({ ...mockData, ci_status: 'success-with-warnings' });
-
- expect(store.isPipelinePassing).toBe(true);
- });
-
- it('is false when the CI status is `failed`', () => {
- store.setData({ ...mockData, ci_status: 'failed' });
-
- expect(store.isPipelinePassing).toBe(false);
- });
-
- it('is false when the CI status is anything except `success`', () => {
- store.setData({ ...mockData, ci_status: 'foobarbaz' });
-
- expect(store.isPipelinePassing).toBe(false);
- });
- });
-
- describe('isPipelineSkipped', () => {
- it('should set isPipelineSkipped=true when the CI status is `skipped`', () => {
- store.setData({ ...mockData, ci_status: 'skipped' });
-
- expect(store.isPipelineSkipped).toBe(true);
- });
-
- it('should set isPipelineSkipped=false when the CI status is anything except `skipped`', () => {
- store.setData({ ...mockData, ci_status: 'foobarbaz' });
-
- expect(store.isPipelineSkipped).toBe(false);
- });
- });
-
- describe('isNothingToMergeState', () => {
- it('returns true when nothingToMerge', () => {
- store.state = stateKey.nothingToMerge;
-
- expect(store.isNothingToMergeState).toEqual(true);
- });
-
- it('returns false when not nothingToMerge', () => {
- store.state = 'state';
-
- expect(store.isNothingToMergeState).toEqual(false);
- });
- });
- });
-
- describe('setPaths', () => {
- it('should set the add ci config path', () => {
- store.setData({ ...mockData });
-
- expect(store.mergeRequestAddCiConfigPath).toEqual('/group2/project2/new/pipeline');
- });
-
- it('should set humanAccess=Maintainer when user has that role', () => {
- store.setData({ ...mockData });
-
- expect(store.humanAccess).toEqual('Maintainer');
- });
-
- it('should set pipelinesEmptySvgPath', () => {
- store.setData({ ...mockData });
-
- expect(store.pipelinesEmptySvgPath).toBe('/path/to/svg');
- });
-
- it('should set newPipelinePath', () => {
- store.setData({ ...mockData });
-
- expect(store.newPipelinePath).toBe('/group2/project2/pipelines/new');
- });
- });
-});