forked from documentationjs/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.js
44 lines (37 loc) · 917 Bytes
/
linker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const LinkerStack = require('../src/output/util/linker_stack');
test('linkerStack', function () {
const linkerStack = new LinkerStack({});
expect(linkerStack.link('string')).toBe(
'https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String'
);
expect(
new LinkerStack({
paths: {
Point: 'http://geojson.org/geojson-spec.html#point'
}
}).link('Point')
).toBe('http://geojson.org/geojson-spec.html#point');
expect(
new LinkerStack({
paths: {
Image: 'http://custom.com/'
}
}).link('Image')
).toBe('http://custom.com/');
const linker = new LinkerStack({
paths: {
Image: 'http://custom.com/'
}
});
linker.namespaceResolver(
[
{
namespace: 'Image'
}
],
function (namespace) {
return '#' + namespace;
}
);
expect(linker.link('Image')).toBe('#Image');
});