Skip to content

Commit

Permalink
test(mixin): improve object test to ensure proper object assign order (
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Nov 21, 2019
1 parent 84e2dc2 commit 29ceca4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/mixin.test.js
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

0 comments on commit 29ceca4

Please sign in to comment.