summaryrefslogtreecommitdiff
path: root/spec/frontend/jobs/store/utils_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 09:06:04 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 09:06:04 +0000
commitbc89882970d6a14b1f72eb9c715fae90b26d066c (patch)
treef5cb59d5130d7585980eb39437071e07ebc12f87 /spec/frontend/jobs/store/utils_spec.js
parent4a45a787703cb78c6101750cfbdc9f656b934b42 (diff)
downloadgitlab-ce-bc89882970d6a14b1f72eb9c715fae90b26d066c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jobs/store/utils_spec.js')
-rw-r--r--spec/frontend/jobs/store/utils_spec.js39
1 files changed, 35 insertions, 4 deletions
diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js
index 780d42fd6a1..1e885b6b788 100644
--- a/spec/frontend/jobs/store/utils_spec.js
+++ b/spec/frontend/jobs/store/utils_spec.js
@@ -1,4 +1,9 @@
-import { logLinesParser, updateIncrementalTrace } from '~/jobs/store/utils';
+import {
+ logLinesParser,
+ updateIncrementalTrace,
+ parseHeaderLine,
+ parseLine,
+} from '~/jobs/store/utils';
import {
utilsMockData,
originalTrace,
@@ -11,6 +16,32 @@ import {
} from '../components/log/mock_data';
describe('Jobs Store Utils', () => {
+ describe('parseHeaderLine', () => {
+ it('returns a new object with the header keys and the provided line parsed', () => {
+ const headerLine = { content: [{ text: 'foo' }] };
+ const parsedHeaderLine = parseHeaderLine(headerLine, 2);
+
+ expect(parsedHeaderLine).toEqual({
+ isClosed: true,
+ isHeader: true,
+ line: {
+ ...headerLine,
+ lineNumber: 2,
+ },
+ lines: [],
+ });
+ });
+ });
+
+ describe('parseLine', () => {
+ it('returns a new object with the lineNumber key added to the provided line object', () => {
+ const line = { content: [{ text: 'foo' }] };
+ const parsed = parseLine(line, 1);
+ expect(parsed.content).toEqual(line.content);
+ expect(parsed.lineNumber).toEqual(1);
+ });
+ });
+
describe('logLinesParser', () => {
let result;
@@ -117,7 +148,7 @@ describe('Jobs Store Utils', () => {
text: 'updated log line',
},
],
- sections: ['section'],
+ section: 'section',
lineNumber: 0,
},
lines: [],
@@ -147,7 +178,7 @@ describe('Jobs Store Utils', () => {
text: 'log line',
},
],
- sections: ['section'],
+ section: 'section',
lineNumber: 0,
},
lines: [
@@ -158,7 +189,7 @@ describe('Jobs Store Utils', () => {
text: 'updated log line',
},
],
- sections: ['section'],
+ section: 'section',
lineNumber: 1,
},
],