Skip to content

Commit

Permalink
Added tests for short console output
Browse files Browse the repository at this point in the history
  • Loading branch information
cisum-la authored Nov 25, 2019
1 parent 771e44a commit 50a49e4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions __tests__/buildJsonResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,24 @@ describe('buildJsonResults', () => {

expect(jsonResults.testsuites[1].testsuite[1]['system-out']).not.toBeDefined();
});

it('should show short console output if includeShortConsoleOutput is true', () => {
const reportWithShortConsoleOutput = require('../__mocks__/test-with-console-output.json');
const jsonResults = buildJsonResults(reportWithShortConsoleOutput, '/',
Object.assign({}, constants.DEFAULT_OPTIONS, {
includeShortConsoleOutput: "true"
}));

expect(jsonResults.testsuites[1].testsuite[1]['system-out']._cdata).toEqual("[\n \"I am bar\",\n \"Some output here from a lib\"\n]");
});

it('should NOT show short console output if includeShortConsoleOutput is not set or false', () => {
const reportWithShortConsoleOutput = require('../__mocks__/test-with-console-output.json');
const jsonResults = buildJsonResults(reportWithShortConsoleOutput, '/',
Object.assign({}, constants.DEFAULT_OPTIONS, {
includeShortConsoleOutput: "false"
}));

expect(jsonResults.testsuites[1].testsuite[1]['system-out']).not.toBeDefined();
});
});

0 comments on commit 50a49e4

Please sign in to comment.