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

test(mixin): improve object test to ensure proper object assign order #745

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/mixin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,24 @@ test('mixin object is not called if below log level', async ({ ok }) => {
})

test('mixin object + logged object', async ({ ok, same }) => {
let n = 0
const stream = sink()
const instance = pino({
mixin () {
return { hello: ++n }
return { foo: 1, bar: 2 }
}
}, stream)
instance.level = name
instance[name]({ foo: 42 })
instance[name]({ bar: 3, baz: 4 })
const result = await once(stream, 'data')
ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()')
delete result.time
same(result, {
pid,
hostname,
level,
foo: 42,
hello: 1,
foo: 1,
bar: 3,
baz: 4,
v: 1
})
})
Expand Down