| ... | @@ -27,21 +27,27 @@ describe('IDE pipelines mutations', () => { |
... | @@ -27,21 +27,27 @@ describe('IDE pipelines mutations', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, () => {
|
|
describe(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, () => {
|
|
|
it('sets loading to false on success', () => {
|
|
const itSetsPipelineLoadingStates = () => {
|
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](
|
|
it('sets has loaded to true', () => {
|
|
|
mockedState,
|
|
expect(mockedState.hasLoadedPipeline).toBe(true);
|
|
|
fullPipelinesResponse.data.pipelines[0],
|
|
});
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
it('sets loading to false on success', () => {
|
|
|
expect(mockedState.isLoadingPipeline).toBe(false);
|
|
expect(mockedState.isLoadingPipeline).toBe(false);
|
|
|
});
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
it('sets latestPipeline', () => {
|
|
describe('with pipeline', () => {
|
|
|
|
beforeEach(() => {
|
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](
|
|
|
mockedState,
|
|
mockedState,
|
|
|
fullPipelinesResponse.data.pipelines[0],
|
|
fullPipelinesResponse.data.pipelines[0],
|
|
|
);
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
itSetsPipelineLoadingStates();
|
|
|
|
|
|
|
|
it('sets latestPipeline', () => {
|
|
|
expect(mockedState.latestPipeline).toEqual({
|
|
expect(mockedState.latestPipeline).toEqual({
|
|
|
id: '51',
|
|
id: '51',
|
|
|
path: 'test',
|
|
path: 'test',
|
| ... | @@ -51,18 +57,7 @@ describe('IDE pipelines mutations', () => { |
... | @@ -51,18 +57,7 @@ describe('IDE pipelines mutations', () => { |
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('does not set latest pipeline if pipeline is null', () => {
|
|
|
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](mockedState, null);
|
|
|
|
|
|
|
|
|
|
expect(mockedState.latestPipeline).toEqual(false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('sets stages', () => {
|
|
it('sets stages', () => {
|
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](
|
|
|
|
|
mockedState,
|
|
|
|
|
fullPipelinesResponse.data.pipelines[0],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(mockedState.stages.length).toBe(2);
|
|
expect(mockedState.stages.length).toBe(2);
|
|
|
expect(mockedState.stages).toEqual([
|
|
expect(mockedState.stages).toEqual([
|
|
|
{
|
|
{
|
| ... | @@ -87,6 +82,19 @@ describe('IDE pipelines mutations', () => { |
... | @@ -87,6 +82,19 @@ describe('IDE pipelines mutations', () => { |
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
describe('with null', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
mutations[types.RECEIVE_LASTEST_PIPELINE_SUCCESS](mockedState, null);
|
|
|
|
});
|
|
|
|
|
|
|
|
itSetsPipelineLoadingStates();
|
|
|
|
|
|
|
|
it('does not set latest pipeline if pipeline is null', () => {
|
|
|
|
expect(mockedState.latestPipeline).toEqual(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
describe(types.REQUEST_JOBS, () => {
|
|
describe(types.REQUEST_JOBS, () => {
|
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
|
mockedState.stages = stages.map((stage, i) => ({
|
|
mockedState.stages = stages.map((stage, i) => ({
|
| ... | |
... | |
| ... | | ... | |