-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up tests too PR-URL: #4033 Credit: @wraithgar Close: #4033 Reviewed-by: @lukekarrys
- Loading branch information
Showing
2 changed files
with
9 additions
and
25 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 |
---|---|---|
@@ -1,28 +1,14 @@ | ||
const t = require('tap') | ||
const { fake: mockNpm } = require('../../fixtures/mock-npm') | ||
const { real: mockNpm } = require('../../fixtures/mock-npm') | ||
|
||
t.test('birthday', async t => { | ||
t.plan(4) | ||
const config = { | ||
yes: false, | ||
package: [], | ||
} | ||
const npm = mockNpm({ | ||
config, | ||
cmd: async (cmd) => { | ||
t.ok(cmd, 'exec', 'calls out to exec command') | ||
return { | ||
exec: async (args) => { | ||
t.equal(npm.config.get('yes'), true, 'should say yes') | ||
t.strictSame(npm.config.get('package'), ['@npmcli/npm-birthday'], | ||
'uses correct package') | ||
t.strictSame(args, ['npm-birthday'], 'called with correct args') | ||
}, | ||
} | ||
t.plan(2) | ||
const { Npm } = mockNpm(t, { | ||
libnpmexec: ({ args, yes }) => { | ||
t.ok(yes) | ||
t.match(args, ['@npmcli/npm-birthday']) | ||
}, | ||
}) | ||
const Birthday = require('../../../lib/commands/birthday.js') | ||
const birthday = new Birthday(npm) | ||
|
||
await birthday.exec([]) | ||
const npm = new Npm() | ||
await npm.exec('birthday', []) | ||
}) |