Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOG-8039 update packages #59

Merged
merged 18 commits into from Apr 6, 2020

fix "details" prop duplicity

  • Loading branch information
alestrunda committed Apr 3, 2020
commit a46d63c0eca2565f38e0579dfdd0877fa9fb3602
@@ -133,7 +133,7 @@ Loggly.prototype.log = function(meta, callback) {
typeof splats[0] === 'object' ? splats.slice(1, splats.length) : splats; //ignore the first object, it's already included in root
if (splats[0].details !== undefined) {
//overwrites the original details prop, so we need to include it
details = [{ details: splats[0].details }, ...data.details];
details = [{ details: splats[0].details }, ...details];
}
if (details.length) data.details = details;
}
@@ -200,4 +200,24 @@ describe('winston integration', () => {
expect.any(Function)
);
});

test('handles "details" prop duplicity', () => {
const level = 'warn';
const message = 'Hello world';
const meta = [{ details: true, secret: 'foo' }, { bar: 'baz' }];
winston.log(level, message, ...meta);
expect(spy).toHaveBeenCalledWith(
{
details: [{ details: true }, meta[1]],
secret: "foo",
level,
message,
[Symbol.for('level')]: level,
[Symbol.for('message')]: JSON.stringify({ ...meta[0], level, message }),
[Symbol.for('splat')]: meta
},
expect.any(Function)
);
});

});
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.