-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
executable file
·52 lines (48 loc) · 1.21 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
51
52
#!/usr/bin/env node
import assert from "assert";
import application from './application.js';
// const cmd = `./index.js --dry --root ./ --prefix /flarp --glob '**/*.{html}'`;
const dry = true;
const verbose = false;
const prefix = '/flarp';
const pattern = `**/*.{html}`;
const cwd = './test/root';
const entries = 'a:href,link:href,img:src,script:src';
const report = [];
await application({ dry, verbose, prefix, pattern, cwd, report, entries });
const actual = report;
const expected = [
[ 'root.html', '/favicon.ico', '/flarp/favicon.ico' ],
[
'root.html',
'/css/bootstrap.min.css',
'/flarp/css/bootstrap.min.css'
],
[
'root.html',
'/images/firefox-icon.png',
'/flarp/images/firefox-icon.png'
],
[
'root.html',
'/js/bootstrap.bundle.min.js',
'/flarp/js/bootstrap.bundle.min.js'
],
[ 'subdir/sub.html', '/favicon.ico', '/flarp/favicon.ico' ],
[
'subdir/sub.html',
'/css/bootstrap.min.css',
'/flarp/css/bootstrap.min.css'
],
[
'subdir/sub.html',
'/images/firefox-icon.png',
'/flarp/images/firefox-icon.png'
],
[
'subdir/sub.html',
'/js/bootstrap.bundle.min.js',
'/flarp/js/bootstrap.bundle.min.js'
]
]
assert.deepEqual(actual, expected);