Skip to content

Commit

Permalink
another test case
Browse files Browse the repository at this point in the history
  • Loading branch information
hiro5id committed Dec 16, 2019
1 parent 6728ba9 commit 0099df6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,22 @@ describe('logger', () => {
expect(testObj.message).eql("string merged - 400");
});


it('concatenates string and error object', async () => {
const {originalWrite, outputText} = overrideStdOut();
LoggerAdaptToConsole();

console.log('string merged ' + new Error('this is inside the error'));

restoreStdOut(originalWrite);
LoggerRestoreConsole();

console.log(outputText[0]);
const testObj = JSON.parse(outputText[0]);
expect(testObj.level).eql("info");
expect(testObj.message).eql("string merged Error: this is inside the error");
});

// Todo: test multiple nested ErrorWithContext objects to ensure proper stacktrace and error messages
});

Expand Down

0 comments on commit 0099df6

Please sign in to comment.