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.
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
var test = require('tap').test;
|
|
var parts = require('..').parts;
|
|
|
|
test('parts of type string', function(t) {
|
|
t.deepEqual(parts('type'), ['type'], 'should return array including type');
|
|
t.end();
|
|
});
|
|
test('parts of type/id string', function(t) {
|
|
t.deepEqual(parts('type/id'), ['type', 'id'], 'should return array including type and id');
|
|
t.end();
|
|
});
|
|
test('parts of type/id/subtype string', function(t) {
|
|
t.deepEqual(parts('type/id/subtype'), ['type', 'id', 'subtype'], 'should return array including type, id and subtype');
|
|
t.end();
|
|
});
|
|
test('parts of type//subtype string', function(t) {
|
|
t.deepEqual(parts('type//subtype'), ['type', undefined, 'subtype'], 'should return array including type, undefined and subtype');
|
|
t.end();
|
|
});
|
|
|
|
test('parts of type object', function(t) {
|
|
t.deepEqual(parts({ type: 'type' }), ['type'], 'should return array including type');
|
|
t.end();
|
|
});
|
|
test('parts of type/id object', function(t) {
|
|
t.deepEqual(parts({ type: 'type', id: 'id'}), ['type', 'id'], 'should return array including type and id');
|
|
t.end();
|
|
});
|
|
test('parts of type/id/subtype object', function(t) {
|
|
t.deepEqual(parts({ type: 'type', id: 'id', subtype: 'subtype' }), ['type', 'id', 'subtype'], 'should return array including type, id and subtype');
|
|
t.end();
|
|
});
|
|
test('parts of type//subtype object', function(t) {
|
|
t.deepEqual(parts({ type: 'type', subtype: 'subtype' }), ['type', undefined, 'subtype'], 'should return array including type, undefined and subtype');
|
|
t.end();
|
|
});
|