-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
50 lines (41 loc) · 1.36 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
/* globals describe, it */
var pluginClear = require('..');
// If we were using additional plugins, we could load them here
var shell = require('shelljs');
var util = require('util');
require('should');
// override console.error() to cover up common.error() calls
console.error = function () { };
describe('plugin-clear', function () {
it('does get added to the shelljs instance', function () {
shell.should.have.property('clear');
});
it('does not interfere with existing commands', function () {
/*
* Plugins shouldn't interfere with existing commands
*/
shell.cp.should.be.type('function');
shell.mv.should.be.type('function');
shell.ls().should.have.property('toEnd');
shell.ls().should.have.property('grep');
shell.ls().should.have.property('sed');
});
it('exports the plugin implementation', function () {
/*
* A plugin author can also export the implementation of their commands
*/
pluginClear.should.be.type('object');
pluginClear.clear.should.be.type('function');
});
it('has a silent return value', function () {
var ret = shell.clear();
util.inspect(ret).should.equal('');
});
it('does not get added as a method on ShellStrings', function () {
/*
* Plugins can be methods on ShellStrings
*/
var ret = shell.ls();
ret.should.not.have.property('clear');
});
});