Skip to content

Commit

Permalink
Complement PR pinojs#139 with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmiehansson committed Jan 24, 2021
1 parent 585c0bb commit 6d0c036
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/lib/utils.public.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,26 @@ tap.test('prettifyObject', t => {
t.is(str, ' foo: "bar"\n')
})

t.test('iterates input and return result from exclusion by ignored keys undefined', async t => {
const keysToIgnore = ['undefined']
const fixture = {
undefined: undefined,
foo: { bar: 'baz' }
}
const res = prettifyObject({ input: fixture, skipKeys: keysToIgnore })
t.is(res, ' foo: {\n "bar": "baz"\n }\n')
})

t.test('iterates input and return result from exclusion by ignored keys foo', async t => {
const keysToIgnore = ['foo']
const fixture = {
undefined: undefined,
foo: { bar: 'baz' }
}
const res = prettifyObject({ input: fixture, skipKeys: keysToIgnore })
t.is(res, '')
})

t.test('works with error props', async t => {
const err = Error('Something went wrong')
const serializedError = {
Expand Down

0 comments on commit 6d0c036

Please sign in to comment.