Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/find-dupes.js')
-rw-r--r--test/lib/find-dupes.js27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/lib/find-dupes.js b/test/lib/find-dupes.js
index 73c8fa2dc..c7b33ceb6 100644
--- a/test/lib/find-dupes.js
+++ b/test/lib/find-dupes.js
@@ -1,15 +1,24 @@
-const { test } = require('tap')
-const requireInject = require('require-inject')
+const t = require('tap')
-test('should run dedupe in dryRun mode', (t) => {
- const findDupes = requireInject('../../lib/find-dupes.js', {
- '../../lib/dedupe.js': function (args, cb) {
- t.ok(args.dryRun, 'dryRun is true')
- cb()
+const FindDupes = require('../../lib/find-dupes.js')
+
+t.test('should run dedupe in dryRun mode', (t) => {
+ t.plan(3)
+ const findDupesTest = new FindDupes({
+ config: {
+ set: (k, v) => {
+ t.match(k, 'dry-run')
+ t.match(v, true)
+ },
+ },
+ commands: {
+ dedupe: (args, cb) => {
+ t.match(args, [])
+ cb()
+ },
},
})
- findDupes(null, () => {
- t.ok(true, 'callback is called')
+ findDupesTest.exec({}, () => {
t.end()
})
})