mirror of https://github.com/jo/docuri.git
configurable parts
parent
ed9f5886e8
commit
6c88aa2372
@ -0,0 +1,28 @@
|
||||
var test = require('tap').test;
|
||||
var docuri = require('..');
|
||||
|
||||
test('default configuration', function(t) {
|
||||
t.deepEqual(docuri(), ['type', 'id', 'subtype', 'index', 'version'], 'should return default parts');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('set configuration', function(t) {
|
||||
var parts = ['my', 'parts'];
|
||||
t.type(docuri(parts).merge, 'function', 'should return docuri api: merge');
|
||||
t.type(docuri(parts).parse, 'function', 'should return docuri api: parse');
|
||||
t.type(docuri(parts).stringify, 'function', 'should return docuri api: stringify');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('change configuration', function(t) {
|
||||
var parts = ['my', 'parts'];
|
||||
docuri(parts);
|
||||
t.deepEqual(docuri(), parts, 'should return custom parts');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('use changed configuration', function(t) {
|
||||
var parts = ['my', 'parts'];
|
||||
t.deepEqual(docuri(parts).parse('one/two'), { my: 'one', parts: 'two'}, 'should use custom parts');
|
||||
t.end();
|
||||
});
|
Loading…
Reference in New Issue