Skip to content

Commit 92916aa

Browse files
authored
Add tests to verify logger does not alter its parameters (#873)
1 parent d7d455a commit 92916aa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/logger.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,22 @@ describe(`logger (${
109109
});
110110
});
111111

112+
it('should not alter parameters that are logged', () => {
113+
const circ: any = { b: 'foo' };
114+
circ.array = [circ];
115+
circ.object = circ;
116+
const entry: logger.LogEntry = {
117+
severity: 'ERROR',
118+
message: 'testing circular',
119+
circ,
120+
};
121+
logger.write(entry);
122+
123+
expect(circ.array[0].b).to.equal('foo');
124+
expect(circ.object.b).to.equal('foo');
125+
expect(circ.object.array[0].object.array[0].b).to.equal('foo');
126+
});
127+
112128
for (const severity of ['DEBUG', 'INFO', 'NOTICE']) {
113129
it(`should output ${severity} severity to stdout`, () => {
114130
let entry: logger.LogEntry = {

0 commit comments

Comments
 (0)