Commit 2fe57353 authored by Nick Thomas's avatar Nick Thomas

Avoid array indices to fixtures in JS specs

parent bbe00038
...@@ -10,9 +10,10 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -10,9 +10,10 @@ describe('Pipelines table in Commits and Merge requests', () => {
preloadFixtures(jsonFixtureName); preloadFixtures(jsonFixtureName);
beforeEach(() => { beforeEach(() => {
const pipelines = getJSONFixture(jsonFixtureName).pipelines;
PipelinesTable = Vue.extend(pipelinesTable); PipelinesTable = Vue.extend(pipelinesTable);
const pipelines = getJSONFixture(jsonFixtureName).pipelines; // sorted by id, descending pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
pipeline = pipelines[2];
}); });
describe('successful request', () => { describe('successful request', () => {
......
...@@ -23,10 +23,11 @@ describe('Pipelines Table Row', () => { ...@@ -23,10 +23,11 @@ describe('Pipelines Table Row', () => {
preloadFixtures(jsonFixtureName); preloadFixtures(jsonFixtureName);
beforeEach(() => { beforeEach(() => {
const pipelines = getJSONFixture(jsonFixtureName).pipelines; // sorted by id, descending const pipelines = getJSONFixture(jsonFixtureName).pipelines;
pipeline = pipelines[2];
pipelineWithoutAuthor = pipelines[1]; pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
pipelineWithoutCommit = pipelines[0]; pipelineWithoutAuthor = pipelines.find(p => p.user == null && p.commit !== null);
pipelineWithoutCommit = pipelines.find(p => p.user == null && p.commit == null);
}); });
afterEach(() => { afterEach(() => {
......
...@@ -11,9 +11,10 @@ describe('Pipelines Table', () => { ...@@ -11,9 +11,10 @@ describe('Pipelines Table', () => {
preloadFixtures(jsonFixtureName); preloadFixtures(jsonFixtureName);
beforeEach(() => { beforeEach(() => {
const pipelines = getJSONFixture(jsonFixtureName).pipelines;
PipelinesTableComponent = Vue.extend(pipelinesTableComp); PipelinesTableComponent = Vue.extend(pipelinesTableComp);
const pipelines = getJSONFixture(jsonFixtureName).pipelines; // ordered by id, descending pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
pipeline = pipelines[2];
}); });
describe('table', () => { describe('table', () => {
......
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