-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
55 lines (47 loc) · 1.65 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*!
* npm-related <https://github.com/tunnckoCore/npm-related>
*
* Copyright (c) 2015-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
var test = require('assertit')
var related = require('./index')
test('should get a package.json from npm:', function (done) {
related('micromatch', function (err, res) {
test.ifError(err)
test.strictEqual(/\[micromatch\]/.test(res), true)
done()
})
})
test('should get an array of package.json files:', function (done) {
related(['micromatch', 'assemble'], function (err, res) {
test.ifError(err)
test.strictEqual(/\[micromatch\]/.test(res), true)
test.strictEqual(/\[assemble\]/.test(res), true)
done()
})
})
test('should remove a name passed on `options.remove`:', function (done) {
var list = ['assemble', 'verb', 'remarkable', 'snippet']
related(list, {remove: 'remarkable'}, function (err, res) {
test.ifError(err)
test.strictEqual(/\[assemble\]/.test(res), true)
test.strictEqual(/\[remarkable\]/.test(res), false)
test.strictEqual(/\[verb\]/.test(res), true)
test.strictEqual(/\[snippet\]/.test(res), true)
done()
})
})
test('should remove a name passed on `options.remove`:', function (done) {
var list = ['assemble', 'verb', 'remarkable', 'snippet']
related(list, {remove: ['remarkable', 'verb']}, function (err, res) {
test.ifError(err)
test.strictEqual(/\[assemble\]/.test(res), true)
test.strictEqual(/\[remarkable\]/.test(res), false)
test.strictEqual(/\[verb\]/.test(res), false)
test.strictEqual(/\[snippet\]/.test(res), true)
done()
})
})