aboutsummaryrefslogtreecommitdiff
path: root/website/src/docs-path.test.ts
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-14 02:41:24 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-14 02:44:46 +0300
commitca7ae086e8d6e80f6efc969d541b390328a6d143 (patch)
tree85605d0551af1dd2a25dce633fd83a06281598d7 /website/src/docs-path.test.ts
parent2e5da968ea3fb7105c56f7674caf822de41ec176 (diff)
fix(website): scope docs search by locale and channel
Diffstat (limited to 'website/src/docs-path.test.ts')
-rw-r--r--website/src/docs-path.test.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/website/src/docs-path.test.ts b/website/src/docs-path.test.ts
new file mode 100644
index 00000000..26f9a701
--- /dev/null
+++ b/website/src/docs-path.test.ts
@@ -0,0 +1,32 @@
+import { describe, expect, test } from 'bun:test';
+import { docsChannel, docsPath } from './docs-path';
+
+describe('docsChannel', () => {
+ test.each([
+ ['/docs/', 'stable'],
+ ['/ja/docs/install/', 'stable'],
+ ['/zh-cn/docs/', 'stable'],
+ ['/docs/preview/', 'preview'],
+ ['/ja/docs/preview/install/', 'preview'],
+ ['/zh-cn/docs/preview/', 'preview'],
+ ])('maps %s to %s', (pathname, expected) => {
+ expect(docsChannel(pathname)).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'],
+ ['preview/zh-cn/install.mdx', 'zh-cn/docs/preview/install'],
+ ])('maps %s to %s', (entry, expected) => {
+ expect(docsPath({ entry })).toBe(expected);
+ });
+});