-
Notifications
You must be signed in to change notification settings - Fork 670
Expand file tree
/
Copy pathroutes.test.ts
More file actions
99 lines (79 loc) · 3 KB
/
Copy pathroutes.test.ts
File metadata and controls
99 lines (79 loc) · 3 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { describe, expect, it } from 'vitest'
import { getRoutes, localizeHref } from './routes'
describe('localizeHref', () => {
it('prefixes an internal path for a non-default locale', () => {
expect(localizeHref('/mcp', 'zh-CN')).toBe('/zh-CN/mcp')
})
it('leaves the default locale unprefixed', () => {
expect(localizeHref('/mcp', 'en')).toBe('/mcp')
})
it('passes external URLs through unchanged', () => {
expect(
localizeHref('https://docs.comfy.org/agent-tools/cloud', 'zh-CN')
).toBe('https://docs.comfy.org/agent-tools/cloud')
})
it('never prefixes locale-invariant routes', () => {
expect(localizeHref('/terms-of-service', 'zh-CN')).toBe('/terms-of-service')
})
})
describe('getRoutes models', () => {
it('serves the models catalog at its canonical path for zh-CN', () => {
expect(getRoutes('zh-CN').models).toBe('/p/supported-models')
})
})
describe('getRoutes modelsShowcase', () => {
it('serves the models showcase page at its canonical path for en', () => {
expect(getRoutes('en').modelsShowcase).toBe('/models')
})
it('serves a localized models showcase path for zh-CN', () => {
expect(getRoutes('zh-CN').modelsShowcase).toBe('/zh-CN/models')
})
})
describe('getRoutes seedance', () => {
it('serves the seedance page at its canonical path for en', () => {
expect(getRoutes('en').seedance).toBe('/seedance-2.5')
})
it('serves a localized seedance path for zh-CN', () => {
expect(getRoutes('zh-CN').seedance).toBe('/zh-CN/seedance-2.5')
})
})
describe('getRoutes ltx', () => {
it('serves the ltx page at its canonical path for en', () => {
expect(getRoutes('en').ltx).toBe('/ltx-2.5')
})
it('serves a localized ltx path for zh-CN', () => {
expect(getRoutes('zh-CN').ltx).toBe('/zh-CN/ltx-2.5')
})
})
describe('getRoutes minimaxMusic3', () => {
it('serves the minimax music 3 page at its canonical path for en', () => {
expect(getRoutes('en').minimaxMusic3).toBe('/minimax-music-3')
})
it('serves a localized minimax music 3 path for zh-CN', () => {
expect(getRoutes('zh-CN').minimaxMusic3).toBe('/zh-CN/minimax-music-3')
})
})
describe('getRoutes minimax', () => {
it('serves the minimax page at its canonical path for en', () => {
expect(getRoutes('en').minimax).toBe('/minimax-h3')
})
it('serves a localized minimax path for zh-CN', () => {
expect(getRoutes('zh-CN').minimax).toBe('/zh-CN/minimax-h3')
})
})
describe('getRoutes flux3', () => {
it('serves the flux 3 page at its canonical path for en', () => {
expect(getRoutes('en').flux3).toBe('/flux-3')
})
it('serves a localized flux 3 path for zh-CN', () => {
expect(getRoutes('zh-CN').flux3).toBe('/zh-CN/flux-3')
})
})
describe('getRoutes fdct', () => {
it('serves the fdct page at its canonical path for en', () => {
expect(getRoutes('en').fdct).toBe('/forward-deployed-creatives')
})
it('serves a localized fdct path for zh-CN', () => {
expect(getRoutes('zh-CN').fdct).toBe('/zh-CN/forward-deployed-creatives')
})
})