1 | "use strict";
|
2 | var _this = this;
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | var tslib_1 = require("tslib");
|
5 | var chai_1 = require("chai");
|
6 | var __1 = require("..");
|
7 | describe('glob', function () {
|
8 | describe('find', function () {
|
9 | it('finds several files', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
10 | var pattern, result;
|
11 | return tslib_1.__generator(this, function (_a) {
|
12 | switch (_a.label) {
|
13 | case 0:
|
14 | pattern = __dirname + "/glob*.ts";
|
15 | return [4, __1.glob.find(pattern)];
|
16 | case 1:
|
17 | result = _a.sent();
|
18 | chai_1.expect(result.length).to.eql(2);
|
19 | chai_1.expect(result[0].endsWith('glob.test.ts')).to.eql(true);
|
20 | chai_1.expect(result[1].endsWith('glob.ts')).to.eql(true);
|
21 | return [2];
|
22 | }
|
23 | });
|
24 | }); });
|
25 | });
|
26 | describe('match', function () {
|
27 | it('is a match', function () {
|
28 | chai_1.expect(__1.glob.isMatch('*.foo', 'bar.foo')).to.eql(true);
|
29 | chai_1.expect(__1.glob.isMatch('**/*.ts', '/foo/bar/file.ts')).to.eql(true);
|
30 | });
|
31 | it('is not a match', function () {
|
32 | chai_1.expect(__1.glob.isMatch('*.bar', 'bar.foo')).to.eql(false);
|
33 | });
|
34 | it('curries pattern (matcher)', function () {
|
35 | var match = __1.glob.matcher('**/foo/*.ts');
|
36 | chai_1.expect(match('/root/foo/file.ts')).to.eql(true);
|
37 | chai_1.expect(match('/root/child/foo/file.ts')).to.eql(true);
|
38 | chai_1.expect(match('/root/bar/file.ts')).to.eql(false);
|
39 | });
|
40 | });
|
41 | });
|
42 |
|
\ | No newline at end of file |