Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:07:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:07:33 +0300
commit6b75320f525f841454f1ab162d141d3610f2e77b (patch)
tree4971c27759e4fbc18b85e71800c3b9c12346317e /spec/frontend/jobs
parent4226aca420920c1844e8eade4798a2dff188a6fc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jobs')
-rw-r--r--spec/frontend/jobs/store/mutations_spec.js75
-rw-r--r--spec/frontend/jobs/store/utils_spec.js7
2 files changed, 82 insertions, 0 deletions
diff --git a/spec/frontend/jobs/store/mutations_spec.js b/spec/frontend/jobs/store/mutations_spec.js
index 6576f3d1ff2..d1ab152330e 100644
--- a/spec/frontend/jobs/store/mutations_spec.js
+++ b/spec/frontend/jobs/store/mutations_spec.js
@@ -80,6 +80,81 @@ describe('Jobs Store Mutations', () => {
expect(stateCopy.traceSize).toEqual(511846);
expect(stateCopy.isTraceComplete).toEqual(true);
});
+
+ describe('with new job log', () => {
+ let stateWithNewLog;
+ beforeEach(() => {
+ gon.features = gon.features || {};
+ gon.features.jobLogJson = true;
+
+ stateWithNewLog = state();
+ });
+
+ afterEach(() => {
+ gon.features.jobLogJson = false;
+ });
+
+ describe('log.lines', () => {
+ describe('when append is true', () => {
+ it('sets the parsed log ', () => {
+ mutations[types.RECEIVE_TRACE_SUCCESS](stateWithNewLog, {
+ append: true,
+ size: 511846,
+ complete: true,
+ lines: [
+ {
+ offset: 1,
+ content: [{ text: 'Running with gitlab-runner 11.12.1 (5a147c92)' }],
+ },
+ ],
+ });
+
+ expect(stateWithNewLog.trace).toEqual([
+ {
+ offset: 1,
+ content: [{ text: 'Running with gitlab-runner 11.12.1 (5a147c92)' }],
+ lineNumber: 0,
+ },
+ ]);
+ });
+ });
+
+ describe('when it is defined', () => {
+ it('sets the parsed log ', () => {
+ mutations[types.RECEIVE_TRACE_SUCCESS](stateWithNewLog, {
+ append: false,
+ size: 511846,
+ complete: true,
+ lines: [
+ { offset: 0, content: [{ text: 'Running with gitlab-runner 11.11.1 (5a147c92)' }] },
+ ],
+ });
+
+ expect(stateWithNewLog.trace).toEqual([
+ {
+ offset: 0,
+ content: [{ text: 'Running with gitlab-runner 11.11.1 (5a147c92)' }],
+ lineNumber: 0,
+ },
+ ]);
+ });
+ });
+
+ describe('when it is null', () => {
+ it('sets the default value', () => {
+ mutations[types.RECEIVE_TRACE_SUCCESS](stateWithNewLog, {
+ append: true,
+ html,
+ size: 511846,
+ complete: false,
+ lines: null,
+ });
+
+ expect(stateWithNewLog.trace).toEqual([]);
+ });
+ });
+ });
+ });
});
describe('STOP_POLLING_TRACE', () => {
diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js
index 9890e01460e..43dacfe622c 100644
--- a/spec/frontend/jobs/store/utils_spec.js
+++ b/spec/frontend/jobs/store/utils_spec.js
@@ -291,6 +291,13 @@ describe('Jobs Store Utils', () => {
});
});
});
+
+ describe('when no data is provided', () => {
+ it('returns an empty array', () => {
+ const result = findOffsetAndRemove();
+ expect(result).toEqual([]);
+ });
+ });
});
describe('getIncrementalLineNumber', () => {