-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathurl.test.mjs
More file actions
32 lines (21 loc) · 877 Bytes
/
url.test.mjs
File metadata and controls
32 lines (21 loc) · 877 Bytes
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
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { buildApiDocURL } from '../url.mjs';
const BASE = 'https://nodejs.org/';
describe('buildApiDocURL', () => {
it('builds markdown doc URLs from doc/ sources', () => {
const entry = { api_doc_source: 'doc/api/fs.md' };
const result = buildApiDocURL(entry);
assert.equal(result.href, `${BASE}docs/latest/api/fs.md`);
});
it('builds html doc URLs when requested', () => {
const entry = { api_doc_source: 'doc/api/path.md' };
const result = buildApiDocURL(entry, true);
assert.equal(result.href, `${BASE}docs/latest/api/path.html`);
});
it('leaves non doc/ sources untouched', () => {
const entry = { api_doc_source: 'api/crypto.md' };
const result = buildApiDocURL(entry);
assert.equal(result.href, `${BASE}api/crypto.md`);
});
});