-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
run-helpers.spec.js
50 lines (44 loc) · 1.3 KB
/
run-helpers.spec.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
'use strict';
const {validatePlugin, list} = require('../../../lib/cli/run-helpers');
const {createSandbox} = require('sinon');
describe('cli "run" command', function() {
let sandbox;
beforeEach(function() {
sandbox = createSandbox();
});
afterEach(function() {
sandbox.restore();
});
describe('helpers', function() {
describe('validatePlugin()', function() {
it('should disallow an array of module names', function() {
expect(
() => validatePlugin({foo: ['bar']}, 'foo'),
'to throw a',
TypeError
);
});
});
describe('list()', function() {
describe('when provided a flat array', function() {
it('should return a flat array', function() {
expect(list(['foo', 'bar']), 'to equal', ['foo', 'bar']);
});
});
describe('when provided a nested array', function() {
it('should return a flat array', function() {
expect(list([['foo', 'bar'], 'baz']), 'to equal', [
'foo',
'bar',
'baz'
]);
});
});
describe('when given a comma-delimited string', function() {
it('should return a flat array', function() {
expect(list('foo,bar'), 'to equal', ['foo', 'bar']);
});
});
});
});
});