source: trip-planner-front/node_modules/wildcard/test/arrays.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 983 bytes
Line 
1var test = require('tape'),
2 wildcard = require('../'),
3 testdata = [
4 'a.b.c',
5 'a.b',
6 'a',
7 'a.b.d'
8 ],
9 testdataSep = [
10 'a:b:c',
11 'a:b',
12 'a',
13 'a:b:d'
14 ];
15
16test('array result matching tests', function(t) {
17 t.plan(5);
18
19 t.equal(wildcard('*', testdata).length, 4, '* matches all testdata');
20 t.equal(wildcard('a.*', testdata).length, 4, '4 matches found');
21 t.equal(wildcard('a.b.*', testdata).length, 3, '3 matches found');
22 t.equal(wildcard('a.*.c', testdata).length, 1);
23 t.equal(wildcard('b.*.d', testdata).length, 0);
24});
25
26test('array result with separator matching tests', function(t) {
27 t.plan(4);
28
29 t.equal(wildcard('a:*', testdataSep, ':').length, 4, '4 matches found');
30 t.equal(wildcard('a:b:*', testdataSep, ':').length, 3, '3 matches found');
31 t.equal(wildcard('a:*:c', testdataSep, ':').length, 1);
32 t.equal(wildcard('b:*:d', testdataSep, ':').length, 0);
33});
Note: See TracBrowser for help on using the repository browser.