-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
39 lines (31 loc) · 1.02 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
/*!
* is-installed <https://github.com/tunnckoCore/is-installed>
*
* Copyright (c) Charlike Mike Reagent <@tunnckoCore> (http://i.am.charlike.online)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
const test = require('mukla')
const isInstalled = require('./index')
test('async: should return true if exists locally or globally', () => {
return isInstalled('npm').then((exists) => {
test.strictEqual(exists, true)
})
})
test('async: should return false if not exists', (done) => {
const promise = isInstalled('sdfsf34f34-fdgdfjk345h345-sfsdf')
promise.then((actual) => {
test.strictEqual(actual, false)
done()
}, done).catch(done)
})
test('sync: should return true if exists on system', (done) => {
test.strictEqual(isInstalled.sync('npm'), true)
test.strictEqual(isInstalled.sync('detect-installed'), true)
done()
})
test('sync: should return false if not exists globally/locally', (done) => {
test.strictEqual(isInstalled.sync('sdakj34h5j34-fg4g54jk60-sasa'), false)
done()
})