aboutsummaryrefslogtreecommitdiff
path: root/website/src/docs-path.test.ts
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-09-01 14:48:45 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-09-01 14:48:45 +0300
commit8a6d697308162874a236c84aac0b0f8c7ac01f83 (patch)
treeed7dc7e8c6f50d66bde721fae78576aede929f66 /website/src/docs-path.test.ts
parentb54a78aa510b87d1e3b56c619b72eaeb59e4a2a1 (diff)
refactor: separate website presentation from runtime
Diffstat (limited to 'website/src/docs-path.test.ts')
-rw-r--r--website/src/docs-path.test.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/website/src/docs-path.test.ts b/website/src/docs-path.test.ts
deleted file mode 100644
index 0fadb26e..00000000
--- a/website/src/docs-path.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { describe, expect, test } from 'bun:test';
-import { docsPath, docsRoute, docsTargetHref, docsVersion } from './docs-path';
-
-const scopes = {
- stable: { locales: { root: ['', 'install'], ja: ['', 'install'] } },
- preview: { locales: { root: ['', 'install', 'new-page'], ja: ['', 'install'] } },
- '0.7.4': { locales: { root: ['', 'install'], ja: [''] } },
-};
-
-describe('docsRoute', () => {
- test.each([
- ['/docs/', { isDocs: true, locale: undefined, target: 'stable', page: '' }],
- ['/ja/docs/install/', { isDocs: true, locale: 'ja', target: 'stable', page: 'install' }],
- ['/docs/preview/new-page/', { isDocs: true, locale: undefined, target: 'preview', page: 'new-page' }],
- ['/zh-cn/docs/preview/', { isDocs: true, locale: 'zh-cn', target: 'preview', page: '' }],
- ['/docs/0.7.4/install/', { isDocs: true, locale: undefined, target: '0.7.4', page: 'install' }],
- ['/ja/docs/0.7.4/', { isDocs: true, locale: 'ja', target: '0.7.4', page: '' }],
- ['/blog/', { isDocs: false, locale: undefined, target: 'stable', page: '' }],
- ])('parses %s', (pathname, expected) => {
- expect(docsRoute(pathname)).toEqual(expected);
- });
-});
-
-describe('docsVersion', () => {
- test.each([
- ['/docs/', 'stable'],
- ['/ja/docs/preview/install/', 'preview'],
- ['/zh-cn/docs/0.7.4/', '0.7.4'],
- ])('maps %s', (pathname, version) => {
- expect(docsVersion(pathname)).toBe(version);
- });
-});
-
-describe('docsTargetHref', () => {
- test.each([
- ['/docs/install/', 'preview', '/docs/preview/install/'],
- ['/ja/docs/install/', '0.7.4', '/ja/docs/0.7.4/'],
- ['/docs/0.7.4/install/', 'stable', '/docs/install/'],
- ['/docs/preview/new-page/', '0.7.4', '/docs/0.7.4/'],
- ])('maps %s to %s', (pathname, target, expected) => {
- expect(docsTargetHref(docsRoute(pathname), target, scopes)).toBe(expected);
- });
-});
-
-describe('docsPath', () => {
- test.each([
- ['index.mdx', 'docs'],
- ['install.mdx', 'docs/install'],
- ['ja/index.mdx', 'ja/docs'],
- ['ja/install.mdx', 'ja/docs/install'],
- ['zh-cn/install.mdx', 'zh-cn/docs/install'],
- ['preview/index.mdx', 'docs/preview'],
- ['preview/install.mdx', 'docs/preview/install'],
- ['preview/ja/index.mdx', 'ja/docs/preview'],
- ['preview/ja/install.mdx', 'ja/docs/preview/install'],
- ['_versions/0.7.4/index.mdx', 'docs/0.7.4'],
- ['_versions/0.7.4/install.mdx', 'docs/0.7.4/install'],
- ['_versions/0.7.4/ja/index.mdx', 'ja/docs/0.7.4'],
- ['_versions/0.7.4/zh-cn/install.mdx', 'zh-cn/docs/0.7.4/install'],
- ])('maps %s to %s', (entry, expected) => {
- expect(docsPath({ entry })).toBe(expected);
- });
-});