summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-05-30 10:59:29 +0100
committerPhil Hughes <me@iamphill.com>2018-05-30 10:59:29 +0100
commit8f646faf3dc2ded677a9a5fbca16b5da9b146d19 (patch)
treeb09fd1baea4271c0012f48fff2495f79d67accff /spec
parentc760965079fce0f020980987794ea61c86eb09ff (diff)
downloadgitlab-ce-8f646faf3dc2ded677a9a5fbca16b5da9b146d19.tar.gz
improved stored data
created reset action to reset stored merge requests
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/ide/mock_data.js2
-rw-r--r--spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js16
-rw-r--r--spec/javascripts/ide/stores/modules/merge_requests/mutations_spec.js14
3 files changed, 31 insertions, 1 deletions
diff --git a/spec/javascripts/ide/mock_data.js b/spec/javascripts/ide/mock_data.js
index 3c09ff36afa..8f24114de26 100644
--- a/spec/javascripts/ide/mock_data.js
+++ b/spec/javascripts/ide/mock_data.js
@@ -96,8 +96,10 @@ export const fullPipelinesResponse = {
export const mergeRequests = [
{
+ id: 1,
iid: 1,
title: 'Test merge request',
project_id: 1,
+ web_url: `${gl.TEST_HOST}/namespace/project-path/merge_requests/1`,
},
];
diff --git a/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js b/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
index 5d076577753..3b88ac36683 100644
--- a/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
+++ b/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
@@ -7,6 +7,7 @@ import actions, {
receiveMergeRequestsError,
receiveMergeRequestsSuccess,
fetchMergeRequests,
+ resetMergeRequests,
} from '~/ide/stores/modules/merge_requests/actions';
import { mergeRequests } from '../../../mock_data';
import testAction from '../../../../helpers/vuex_action_helper';
@@ -93,7 +94,7 @@ describe('IDe merge requests actions', () => {
expect(apiSpy).toHaveBeenCalledWith(jasmine.anything(), {
params: {
scope: 'assigned-to-me',
- view: 'simple',
+ state: 'opened',
},
});
});
@@ -141,4 +142,17 @@ describe('IDe merge requests actions', () => {
});
});
});
+
+ describe('resetMergeRequests', () => {
+ it('commits reset', done => {
+ testAction(
+ resetMergeRequests,
+ null,
+ mockedState,
+ [{ type: types.RESET_MERGE_REQUESTS }],
+ [],
+ done,
+ );
+ });
+ });
});
diff --git a/spec/javascripts/ide/stores/modules/merge_requests/mutations_spec.js b/spec/javascripts/ide/stores/modules/merge_requests/mutations_spec.js
index 8983bf65b31..664d3914564 100644
--- a/spec/javascripts/ide/stores/modules/merge_requests/mutations_spec.js
+++ b/spec/javascripts/ide/stores/modules/merge_requests/mutations_spec.js
@@ -28,14 +28,28 @@ describe('IDE merge requests mutations', () => {
describe(types.RECEIVE_MERGE_REQUESTS_SUCCESS, () => {
it('sets merge requests', () => {
+ gon.gitlab_url = gl.TEST_HOST;
mutations[types.RECEIVE_MERGE_REQUESTS_SUCCESS](mockedState, mergeRequests);
expect(mockedState.mergeRequests).toEqual([
{
id: 1,
+ iid: 1,
title: 'Test merge request',
+ projectId: 1,
+ projectPathWithNamespace: 'namespace/project-path',
},
]);
});
});
+
+ describe(types.RESET_MERGE_REQUESTS, () => {
+ it('clears merge request array', () => {
+ mockedState.mergeRequests = ['test'];
+
+ mutations[types.RESET_MERGE_REQUESTS](mockedState);
+
+ expect(mockedState.mergeRequests).toEqual([]);
+ });
+ });
});