-
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.
Drive out a fresh impl of initialize-names
Turns out most of the logic was pretty dumb and it's new behavior so I just axed most of it
- Loading branch information
Showing
2 changed files
with
25 additions
and
8 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
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,23 @@ | ||
import subject from '../../../src/imitate/initialize-names' | ||
|
||
module.exports = { | ||
'passed a non-null names': () => { | ||
assert.equal(subject(null, 'foo'), 'foo') | ||
}, | ||
'an array type': () => { | ||
assert.deepEqual(subject(['lol']), []) | ||
}, | ||
'an arguments type': () => { | ||
let args = (function () { return arguments })(1,2,3) | ||
assert.deepEqual(subject(args), []) | ||
}, | ||
'an anon function': () => { | ||
assert.deepEqual(subject(function () {}), []) | ||
}, | ||
'a named function': () => { | ||
assert.deepEqual(subject(function blah () {}), ['blah']) | ||
}, | ||
'a plain object': () => { | ||
assert.deepEqual(subject({}), []) | ||
} | ||
} |