Files
MyIP/tests/docs-url.test.js
T
jason5ng32andClaude Fable 5.1 7a608cb8ce Feat(footer): fold the product links into a four-column footer
The Raycast / curl / Lite badges sat in an unlabelled image row of their
own under the Advanced Tools. The footer now has four columns aligned
with that card grid — brand, Project, Docs & Support, Clients — so the
product entries get a heading and show on every route; the curl
commands keep their dialog. Docs links share one locale-aware helper.
The footer never repeats on-page content, and the fixed footer height
in style.css goes, as the columns size themselves.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 18:45:09 +08:00

37 lines
1.6 KiB
JavaScript

// docsUrl() — locale-aware links into docs.ipcheck.ing.
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { docsUrl } from '../frontend/utils/docs-url.js';
describe('docsUrl()', () => {
it('puts English at the section root', () => {
assert.equal(docsUrl('knowledge-base', 'en'), 'https://docs.ipcheck.ing/knowledge-base/');
assert.equal(docsUrl('developer', 'en'), 'https://docs.ipcheck.ing/developer/');
});
it('puts any other locale under the section', () => {
assert.equal(docsUrl('knowledge-base', 'zh'), 'https://docs.ipcheck.ing/knowledge-base/zh/');
assert.equal(docsUrl('developer', 'pt-BR'), 'https://docs.ipcheck.ing/developer/pt-BR/');
});
it('appends the path after the locale segment', () => {
assert.equal(docsUrl('developer', 'en', 'getting-started/'), 'https://docs.ipcheck.ing/developer/getting-started/');
assert.equal(docsUrl('developer', 'zh', 'getting-started/'), 'https://docs.ipcheck.ing/developer/zh/getting-started/');
});
it('never produces a double slash', () => {
const urls = [
docsUrl('/developer/', 'zh', '/getting-started/'),
docsUrl('developer', 'en', '/getting-started/'),
docsUrl('developer/', 'fr'),
];
for (const url of urls) assert.doesNotMatch(url.replace('https://', ''), /\/\//);
assert.equal(urls[0], 'https://docs.ipcheck.ing/developer/zh/getting-started/');
});
it('treats a missing locale as English', () => {
assert.equal(docsUrl('developer', undefined), 'https://docs.ipcheck.ing/developer/');
});
});