mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
* style(prettier): Use prettier for code formatting This saves us style issues. Also adds husky and lint-staged for pre-commit testing Refs https://github.com/documentationjs/documentation/issues/709
55 lines
1.1 KiB
JavaScript
55 lines
1.1 KiB
JavaScript
'use strict';
|
|
var LinkerStack = require('../lib/output/util/linker_stack'),
|
|
test = require('tap').test;
|
|
|
|
test('linkerStack', function(t) {
|
|
var linkerStack = new LinkerStack({});
|
|
|
|
t.equal(
|
|
linkerStack.link('string'),
|
|
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String',
|
|
'Default global resolution of string'
|
|
);
|
|
|
|
t.equal(
|
|
new LinkerStack({
|
|
paths: {
|
|
Point: 'http://geojson.org/geojson-spec.html#point'
|
|
}
|
|
}).link('Point'),
|
|
'http://geojson.org/geojson-spec.html#point',
|
|
'Custom hardcoded path for a GeoJSON type'
|
|
);
|
|
|
|
t.equal(
|
|
new LinkerStack({
|
|
paths: {
|
|
Image: 'http://custom.com/'
|
|
}
|
|
}).link('Image'),
|
|
'http://custom.com/',
|
|
'Prefers config link to native.'
|
|
);
|
|
|
|
var linker = new LinkerStack({
|
|
paths: {
|
|
Image: 'http://custom.com/'
|
|
}
|
|
});
|
|
|
|
linker.namespaceResolver(
|
|
[
|
|
{
|
|
namespace: 'Image'
|
|
}
|
|
],
|
|
function(namespace) {
|
|
return '#' + namespace;
|
|
}
|
|
);
|
|
|
|
t.equal(linker.link('Image'), '#Image', 'Prefers local link over all.');
|
|
|
|
t.end();
|
|
});
|