mirror of https://github.com/jo/docuri.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
var test = require('tap').test;
|
|
var merge = require('..').merge;
|
|
|
|
test('changing type component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {type:'new_type'}), 'new_type/id/subtype/index/version', 'should return docuri string with type changed');
|
|
t.end();
|
|
});
|
|
|
|
test('changing id component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {id:'new_id'}), 'type/new_id/subtype/index/version', 'should return docuri string with id changed');
|
|
t.end();
|
|
});
|
|
|
|
test('changing subtype component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {subtype:'new_subtype'}), 'type/id/new_subtype/index/version', 'should return docuri string with subtype changed');
|
|
t.end();
|
|
});
|
|
|
|
test('changing index component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {index:'new_index'}), 'type/id/subtype/new_index/version', 'should return docuri string with index changed');
|
|
t.end();
|
|
});
|
|
|
|
test('changing version component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {version:'new_version'}), 'type/id/subtype/index/new_version', 'should return docuri string with version changed');
|
|
t.end();
|
|
});
|
|
|
|
test('changing unknown component', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version', {unknown:'i dont know'}), 'type/id/subtype/index/version', 'should return unchanged docuri');
|
|
t.end();
|
|
});
|
|
|
|
|
|
test('missing second argument', function(t) {
|
|
t.equal(merge('type/id/subtype/index/version'), 'type/id/subtype/index/version', 'should return unchanged docuri string');
|
|
t.end();
|
|
});
|
|
|
|
|