-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.js
30 lines (26 loc) · 1.06 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
'use strict';
require('mocha');
var assert = require('assert');
var isValidGlob = require('./');
describe('isValidGlob', function() {
it('should return true when the pattern is a valid glob pattern:', function() {
assert.equal(isValidGlob('a'), true);
assert.equal(isValidGlob('a.js'), true);
assert.equal(isValidGlob('*.js'), true);
assert.equal(isValidGlob(['a', 'b']), true);
assert.equal(isValidGlob(['a/**/*.js', '*.js']), true);
});
it('should return false when the pattern is not a valid glob pattern:', function() {
assert.equal(isValidGlob(), false);
assert.equal(isValidGlob(''), false);
assert.equal(isValidGlob({}), false);
assert.equal(isValidGlob([]), false);
assert.equal(isValidGlob(null), false);
assert.equal(isValidGlob(undefined), false);
assert.equal(isValidGlob(new Buffer('foo')), false);
assert.equal(isValidGlob(['foo', [[]]]), false);
assert.equal(isValidGlob(['foo', [['bar']]]), false);
assert.equal(isValidGlob(['foo', {}]), false);
assert.equal(isValidGlob(['']), false);
});
});