1 | var test = require('tap').test;;
|
2 | test('it does the thing it says it does', function(t) {
|
3 | var cf = require('./');;
|
4 |
|
5 | t.equal(cf('/tmp/cache', 'https://foo:134/xyz?adf=foo:bar/baz'),
|
6 | '/tmp/cache/foo_134/xyz_3Fadf_3Dfoo_3Abar/baz');;
|
7 |
|
8 | var getFile = cf('/tmp/cache');;
|
9 | t.equal(getFile('https://foo:134/xyz?adf=foo:bar/baz'),
|
10 | '/tmp/cache/foo_134/xyz_3Fadf_3Dfoo_3Abar/baz');;
|
11 |
|
12 | t.equal(cf("/tmp", "https://foo:134/xyz/-rev/baz"),
|
13 | '/tmp/foo_134/xyz')
|
14 | t.equal(cf("/tmp", "https://foo:134/xyz/?rev=baz"),
|
15 | '/tmp/foo_134/xyz')
|
16 | t.equal(cf("/tmp", "https://foo:134/xyz/?foo&rev=baz"),
|
17 | '/tmp/foo_134/xyz')
|
18 | t.equal(cf("/tmp", "https://foo:134/xyz-rev/baz"),
|
19 | '/tmp/foo_134/xyz-rev/baz')
|
20 | t.equal(cf("/tmp", "git://foo:134/xyz-rev/baz.git#master"),
|
21 | '/tmp/foo_134/xyz-rev/baz.git/master')
|
22 | t.end();
|
23 | });;
|