Commit fdc13baf authored by Jose Vargas's avatar Jose Vargas

Add nullish coalesce checks, touch up specs

parent 1f829bfb
...@@ -132,13 +132,11 @@ export const logLinesParserLegacy = (lines = [], accumulator = []) => ...@@ -132,13 +132,11 @@ export const logLinesParserLegacy = (lines = [], accumulator = []) =>
); );
export const logLinesParser = (lines = [], previousTraceState = {}, prevParsedLines = []) => { export const logLinesParser = (lines = [], previousTraceState = {}, prevParsedLines = []) => {
let currentLine = previousTraceState?.prevLineCount ? previousTraceState.prevLineCount : 0; let currentLine = previousTraceState?.prevLineCount ?? 0;
let currentHeader = previousTraceState?.currentHeader ? previousTraceState.currentHeader : null; let currentHeader = previousTraceState?.currentHeader;
let isPreviousLineHeader = previousTraceState?.isPreviousLineHeader let isPreviousLineHeader = previousTraceState?.isPreviousLineHeader ?? false;
? previousTraceState.isPreviousLineHeader
: false;
const parsedLines = prevParsedLines.length > 0 ? prevParsedLines : []; const parsedLines = prevParsedLines.length > 0 ? prevParsedLines : [];
const sectionsQueue = previousTraceState?.sectionsQueue ? previousTraceState.sectionsQueue : []; const sectionsQueue = previousTraceState?.sectionsQueue ?? [];
for (let i = 0; i < lines.length; i += 1) { for (let i = 0; i < lines.length; i += 1) {
const line = lines[i]; const line = lines[i];
......
...@@ -84,7 +84,7 @@ describe('Job Log', () => { ...@@ -84,7 +84,7 @@ describe('Job Log', () => {
}); });
}); });
describe('Job Log, feature flag enabled', () => { describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => {
let wrapper; let wrapper;
let actions; let actions;
let state; let state;
......
...@@ -323,7 +323,7 @@ describe('Job Store mutations, feature flag ON', () => { ...@@ -323,7 +323,7 @@ describe('Job Store mutations, feature flag ON', () => {
}); });
}); });
describe('when it is defined', () => { describe('when lines are defined', () => {
it('sets the parsed log ', () => { it('sets the parsed log ', () => {
mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, { mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
append: false, append: false,
...@@ -344,7 +344,7 @@ describe('Job Store mutations, feature flag ON', () => { ...@@ -344,7 +344,7 @@ describe('Job Store mutations, feature flag ON', () => {
}); });
}); });
describe('when it is null', () => { describe('when lines are null', () => {
it('sets the default value', () => { it('sets the default value', () => {
mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, { mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
append: true, append: true,
......
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