From bc89882970d6a14b1f72eb9c715fae90b26d066c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 24 Sep 2019 09:06:04 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/jobs/store/utils_spec.js | 39 ++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'spec/frontend/jobs/store/utils_spec.js') 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, }, ], -- cgit v1.2.1