summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-01-24 18:36:54 +0000
committerNick Thomas <nick@gitlab.com>2018-01-24 18:36:54 +0000
commit2fe57353ccc21ce7f513dbd6c8d630d49459c8c9 (patch)
tree9fbdfc60baa4bb5022a0281807c135043f760d6e
parentbbe00038da5b10f8c152332da7d72f38b5552262 (diff)
downloadgitlab-ce-2fe57353ccc21ce7f513dbd6c8d630d49459c8c9.tar.gz
Avoid array indices to fixtures in JS specs
-rw-r--r--spec/javascripts/commit/pipelines/pipelines_spec.js5
-rw-r--r--spec/javascripts/pipelines/pipelines_table_row_spec.js9
-rw-r--r--spec/javascripts/pipelines/pipelines_table_spec.js5
3 files changed, 11 insertions, 8 deletions
diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js b/spec/javascripts/commit/pipelines/pipelines_spec.js
index 80eb918beaf..0afe09d87bc 100644
--- a/spec/javascripts/commit/pipelines/pipelines_spec.js
+++ b/spec/javascripts/commit/pipelines/pipelines_spec.js
@@ -10,9 +10,10 @@ describe('Pipelines table in Commits and Merge requests', () => {
preloadFixtures(jsonFixtureName);
beforeEach(() => {
+ const pipelines = getJSONFixture(jsonFixtureName).pipelines;
+
PipelinesTable = Vue.extend(pipelinesTable);
- const pipelines = getJSONFixture(jsonFixtureName).pipelines; // sorted by id, descending
- pipeline = pipelines[2];
+ pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
});
describe('successful request', () => {
diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js
index d5b9e68cc51..b3cbf9aba48 100644
--- a/spec/javascripts/pipelines/pipelines_table_row_spec.js
+++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js
@@ -23,10 +23,11 @@ describe('Pipelines Table Row', () => {
preloadFixtures(jsonFixtureName);
beforeEach(() => {
- const pipelines = getJSONFixture(jsonFixtureName).pipelines; // sorted by id, descending
- pipeline = pipelines[2];
- pipelineWithoutAuthor = pipelines[1];
- pipelineWithoutCommit = pipelines[0];
+ const pipelines = getJSONFixture(jsonFixtureName).pipelines;
+
+ pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
+ pipelineWithoutAuthor = pipelines.find(p => p.user == null && p.commit !== null);
+ pipelineWithoutCommit = pipelines.find(p => p.user == null && p.commit == null);
});
afterEach(() => {
diff --git a/spec/javascripts/pipelines/pipelines_table_spec.js b/spec/javascripts/pipelines/pipelines_table_spec.js
index 3e2dfce8e17..4fc3c08145e 100644
--- a/spec/javascripts/pipelines/pipelines_table_spec.js
+++ b/spec/javascripts/pipelines/pipelines_table_spec.js
@@ -11,9 +11,10 @@ describe('Pipelines Table', () => {
preloadFixtures(jsonFixtureName);
beforeEach(() => {
+ const pipelines = getJSONFixture(jsonFixtureName).pipelines;
+
PipelinesTableComponent = Vue.extend(pipelinesTableComp);
- const pipelines = getJSONFixture(jsonFixtureName).pipelines; // ordered by id, descending
- pipeline = pipelines[2];
+ pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
});
describe('table', () => {