1 var test = require('tap').test;;
2 test('it does the thing it says it does', function(t) {
3 var cf = require('./');;
5 t.equal(cf('/tmp/cache', 'https://foo:134/xyz?adf=foo:bar/baz'),
6 '/tmp/cache/foo_134/xyz_3Fadf_3Dfoo_3Abar/baz');;
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');;
12 t.equal(cf("/tmp", "https://foo:134/xyz/-rev/baz"),
14 t.equal(cf("/tmp", "https://foo:134/xyz/?rev=baz"),
16 t.equal(cf("/tmp", "https://foo:134/xyz/?foo&rev=baz"),
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')