Skip to content

Commit

Permalink
Merge pull request #16 from muze-nl/test-non-primitives
Browse files Browse the repository at this point in the history
added test of non-primitives
  • Loading branch information
poef authored Sep 23, 2024
2 parents d795f96 + 2c38899 commit 16fb7bf
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/test.select.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,49 @@ tap.test('select-reduce-object', t => {
t.same(2, +result.c)
t.end()
})

tap.test('select-non-primitive-values', t => {
let cleanObject = Object.create(null)
cleanObject.title = 'A title'
let testData = [{
'number': new Number(1),
'boolean': new Boolean(true),
'string': new String('test'),
'clean': cleanObject
}]
let result = from(testData)
.select({
number: _,
boolean: _,
string: _,
clean: _
})
t.same(result, testData)

result = from(testData)
.where({
number: 1
})
t.same(result, testData)

result = from(testData)
.where({
boolean: true
})
t.same(result, testData)

result = from(testData)
.where({
string: 'test'
})
t.same(result, testData)

result = from(testData)
.where({
clean: {
title: 'A title'
}
})
t.same(result, testData)
t.end()
})

0 comments on commit 16fb7bf

Please sign in to comment.