-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/unit/imitate/overwrite-children/is-primitive-like.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import subject from '../../../../src/imitate/overwrite-children/is-primitive-like' | ||
|
||
module.exports = { | ||
'identifies primitive things': () => { | ||
assert.equal(subject(), true) | ||
assert.equal(subject(false), true) | ||
assert.equal(subject(true), true) | ||
assert.equal(subject(undefined), true) | ||
assert.equal(subject(null), true) | ||
assert.equal(subject(1), true) | ||
assert.equal(subject('hi'), true) | ||
assert.equal(subject(NaN), true) | ||
}, | ||
'identifies symbols': () => { | ||
if (!global.Symbol) return | ||
|
||
assert.equal(subject(Symbol.species), true) | ||
}, | ||
'identifies boxed types and basic value types': () => { | ||
assert.equal(subject(new String('hi')), true) // eslint-disable-line | ||
assert.equal(subject(new Boolean(true)), true) // eslint-disable-line | ||
assert.equal(subject(new Number(0)), true) // eslint-disable-line | ||
assert.equal(subject(/hi/), true) | ||
assert.equal(subject(new Date()), true) | ||
}, | ||
'gives functions, arrays, and custom objects a pass': () => { | ||
assert.equal(subject(new Object()), false) // eslint-disable-line | ||
assert.equal(subject(function () {}), false) | ||
assert.equal(subject([]), false) | ||
assert.equal(subject({}), false) | ||
} | ||
} |