Commit 3e878fa8 authored by pburdette's avatar pburdette

Migrate pipeline store spec

Migrate the pipeline store spec
from karma and jest. And actually
make it work.
parent 877b8f2c
...@@ -1766,7 +1766,8 @@ ...@@ -1766,7 +1766,8 @@
"name": "GitLab Docs", "name": "GitLab Docs",
"full_path": "/gitlab-com/gitlab-docs", "full_path": "/gitlab-com/gitlab-docs",
"full_name": "GitLab.com / GitLab Docs" "full_name": "GitLab.com / GitLab Docs"
} },
"triggered": [{}]
}, },
{ {
"id": 34993052, "id": 34993052,
......
...@@ -8,13 +8,11 @@ describe('EE Pipeline store', () => { ...@@ -8,13 +8,11 @@ describe('EE Pipeline store', () => {
beforeEach(() => { beforeEach(() => {
store = new PipelineStore(); store = new PipelineStore();
data = Object.assign({}, LinkedPipelines); data = Object.assign({}, LinkedPipelines);
store.storePipeline(data);
}); });
describe('storePipeline', () => { describe('storePipeline', () => {
beforeAll(() => {
store.storePipeline(data);
});
describe('triggered_by', () => { describe('triggered_by', () => {
it('sets triggered_by as an array', () => { it('sets triggered_by as an array', () => {
expect(store.state.pipeline.triggered_by.length).toEqual(1); expect(store.state.pipeline.triggered_by.length).toEqual(1);
...@@ -50,10 +48,6 @@ describe('EE Pipeline store', () => { ...@@ -50,10 +48,6 @@ describe('EE Pipeline store', () => {
}); });
describe('resetTriggeredByPipeline', () => { describe('resetTriggeredByPipeline', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('closes the pipeline & nested ones', () => { it('closes the pipeline & nested ones', () => {
store.state.pipeline.triggered_by[0].isExpanded = true; store.state.pipeline.triggered_by[0].isExpanded = true;
store.state.pipeline.triggered_by[0].triggered_by[0].isExpanded = true; store.state.pipeline.triggered_by[0].triggered_by[0].isExpanded = true;
...@@ -66,10 +60,6 @@ describe('EE Pipeline store', () => { ...@@ -66,10 +60,6 @@ describe('EE Pipeline store', () => {
}); });
describe('openTriggeredByPipeline', () => { describe('openTriggeredByPipeline', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('opens the given pipeline', () => { it('opens the given pipeline', () => {
store.openTriggeredByPipeline(store.state.pipeline, store.state.pipeline.triggered_by[0]); store.openTriggeredByPipeline(store.state.pipeline, store.state.pipeline.triggered_by[0]);
...@@ -78,10 +68,6 @@ describe('EE Pipeline store', () => { ...@@ -78,10 +68,6 @@ describe('EE Pipeline store', () => {
}); });
describe('closeTriggeredByPipeline', () => { describe('closeTriggeredByPipeline', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('closes the given pipeline', () => { it('closes the given pipeline', () => {
// open it first // open it first
store.openTriggeredByPipeline(store.state.pipeline, store.state.pipeline.triggered_by[0]); store.openTriggeredByPipeline(store.state.pipeline, store.state.pipeline.triggered_by[0]);
...@@ -93,15 +79,11 @@ describe('EE Pipeline store', () => { ...@@ -93,15 +79,11 @@ describe('EE Pipeline store', () => {
}); });
describe('resetTriggeredPipelines', () => { describe('resetTriggeredPipelines', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('closes the pipeline & nested ones', () => { it('closes the pipeline & nested ones', () => {
store.state.pipeline.triggered[0].isExpanded = true; store.state.pipeline.triggered[0].isExpanded = true;
store.state.pipeline.triggered[0].triggered[0].isExpanded = true; store.state.pipeline.triggered[0].triggered[0].isExpanded = true;
store.resetTriggeredPipeline(store.state.pipeline, store.state.pipeline.triggered[0]); store.resetTriggeredPipelines(store.state.pipeline, store.state.pipeline.triggered[0]);
expect(store.state.pipeline.triggered[0].isExpanded).toEqual(false); expect(store.state.pipeline.triggered[0].isExpanded).toEqual(false);
expect(store.state.pipeline.triggered[0].triggered[0].isExpanded).toEqual(false); expect(store.state.pipeline.triggered[0].triggered[0].isExpanded).toEqual(false);
...@@ -109,10 +91,6 @@ describe('EE Pipeline store', () => { ...@@ -109,10 +91,6 @@ describe('EE Pipeline store', () => {
}); });
describe('openTriggeredPipeline', () => { describe('openTriggeredPipeline', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('opens the given pipeline', () => { it('opens the given pipeline', () => {
store.openTriggeredPipeline(store.state.pipeline, store.state.pipeline.triggered[0]); store.openTriggeredPipeline(store.state.pipeline, store.state.pipeline.triggered[0]);
...@@ -121,10 +99,6 @@ describe('EE Pipeline store', () => { ...@@ -121,10 +99,6 @@ describe('EE Pipeline store', () => {
}); });
describe('closeTriggeredPipeline', () => { describe('closeTriggeredPipeline', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('closes the given pipeline', () => { it('closes the given pipeline', () => {
// open it first // open it first
store.openTriggeredPipeline(store.state.pipeline, store.state.pipeline.triggered[0]); store.openTriggeredPipeline(store.state.pipeline, store.state.pipeline.triggered[0]);
...@@ -136,12 +110,8 @@ describe('EE Pipeline store', () => { ...@@ -136,12 +110,8 @@ describe('EE Pipeline store', () => {
}); });
describe('toggleLoading', () => { describe('toggleLoading', () => {
beforeEach(() => {
store.storePipeline(data);
});
it('toggles the isLoading property for the given pipeline', () => { it('toggles the isLoading property for the given pipeline', () => {
store.togglePipeline(store.state.pipeline.triggered[0]); store.toggleLoading(store.state.pipeline.triggered[0]);
expect(store.state.pipeline.triggered[0].isLoading).toEqual(true); expect(store.state.pipeline.triggered[0].isLoading).toEqual(true);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment