summaryrefslogtreecommitdiff
path: root/spec/javascripts/jobs/store/actions_spec.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-10-03 14:13:20 +0000
committerPhil Hughes <me@iamphill.com>2018-10-03 14:13:20 +0000
commitf72a1bf09cce4b4cf01b7eb12da0dc78ce477a9d (patch)
tree20e0575a2397649e3ac023ab13a4800a4c6fe2b3 /spec/javascripts/jobs/store/actions_spec.js
parentc4d9f40291bc9fbdcd5f87c7a2c36c8aea85e64e (diff)
downloadgitlab-ce-f72a1bf09cce4b4cf01b7eb12da0dc78ce477a9d.tar.gz
Moves stages dropdown into the new vue app
Diffstat (limited to 'spec/javascripts/jobs/store/actions_spec.js')
-rw-r--r--spec/javascripts/jobs/store/actions_spec.js54
1 files changed, 21 insertions, 33 deletions
diff --git a/spec/javascripts/jobs/store/actions_spec.js b/spec/javascripts/jobs/store/actions_spec.js
index 5042718dfa0..5ab1f75d0d6 100644
--- a/spec/javascripts/jobs/store/actions_spec.js
+++ b/spec/javascripts/jobs/store/actions_spec.js
@@ -27,7 +27,6 @@ import {
receiveStagesSuccess,
receiveStagesError,
requestJobsForStage,
- setSelectedStage,
fetchJobsForStage,
receiveJobsForStageSuccess,
receiveJobsForStageError,
@@ -236,7 +235,8 @@ describe('Job State actions', () => {
},
{
payload: {
- html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :', complete: true,
+ html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :',
+ complete: true,
},
type: 'receiveTraceSuccess',
},
@@ -421,7 +421,9 @@ describe('Job State actions', () => {
let mock;
beforeEach(() => {
- mockedState.stagesEndpoint = `${TEST_HOST}/endpoint.json`;
+ mockedState.job.pipeline = {
+ path: `${TEST_HOST}/endpoint.json/stages`,
+ };
mock = new MockAdapter(axios);
});
@@ -430,8 +432,10 @@ describe('Job State actions', () => {
});
describe('success', () => {
- it('dispatches requestStages and receiveStagesSuccess ', done => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, [{ id: 121212, name: 'build' }]);
+ it('dispatches requestStages and receiveStagesSuccess, fetchJobsForStage ', done => {
+ mock
+ .onGet(`${TEST_HOST}/endpoint.json/stages`)
+ .replyOnce(200, { details: { stages: [{ id: 121212, name: 'build' }] } });
testAction(
fetchStages,
@@ -446,6 +450,10 @@ describe('Job State actions', () => {
payload: [{ id: 121212, name: 'build' }],
type: 'receiveStagesSuccess',
},
+ {
+ payload: { id: 121212, name: 'build' },
+ type: 'fetchJobsForStage',
+ },
],
done,
);
@@ -516,24 +524,10 @@ describe('Job State actions', () => {
});
});
- describe('setSelectedStage', () => {
- it('should commit SET_SELECTED_STAGE mutation ', done => {
- testAction(
- setSelectedStage,
- { name: 'build' },
- mockedState,
- [{ type: types.SET_SELECTED_STAGE, payload: { name: 'build' } }],
- [],
- done,
- );
- });
- });
-
describe('fetchJobsForStage', () => {
let mock;
beforeEach(() => {
- mockedState.stageJobsEndpoint = `${TEST_HOST}/endpoint.json`;
mock = new MockAdapter(axios);
});
@@ -542,20 +536,18 @@ describe('Job State actions', () => {
});
describe('success', () => {
- it('dispatches setSelectedStage, requestJobsForStage and receiveJobsForStageSuccess ', done => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, [{ id: 121212, name: 'build' }]);
+ it('dispatches requestJobsForStage and receiveJobsForStageSuccess ', done => {
+ mock
+ .onGet(`${TEST_HOST}/jobs.json`)
+ .replyOnce(200, { latest_statuses: [{ id: 121212, name: 'build' }], retried: [] });
testAction(
fetchJobsForStage,
- null,
+ { dropdown_path: `${TEST_HOST}/jobs.json` },
mockedState,
[],
[
{
- type: 'setSelectedStage',
- payload: null,
- },
- {
type: 'requestJobsForStage',
},
{
@@ -570,21 +562,17 @@ describe('Job State actions', () => {
describe('error', () => {
beforeEach(() => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
+ mock.onGet(`${TEST_HOST}/jobs.json`).reply(500);
});
- it('dispatches setSelectedStage, requestJobsForStage and receiveJobsForStageError', done => {
+ it('dispatches requestJobsForStage and receiveJobsForStageError', done => {
testAction(
fetchJobsForStage,
- null,
+ { dropdown_path: `${TEST_HOST}/jobs.json` },
mockedState,
[],
[
{
- payload: null,
- type: 'setSelectedStage',
- },
- {
type: 'requestJobsForStage',
},
{