-
Notifications
You must be signed in to change notification settings - Fork 66.9k
Expand file tree
/
Copy pathllms-txt-translations.ts
More file actions
37 lines (30 loc) · 1.36 KB
/
llms-txt-translations.ts
File metadata and controls
37 lines (30 loc) · 1.36 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
import { describe, expect, test } from 'vitest'
import { get } from '@/tests/helpers/e2etest'
import { languageKeys } from '@/languages/lib/languages-server'
const langs = languageKeys.filter((lang) => lang !== 'en')
describe('llms.txt translations', () => {
test('includes translations section with all languages', async () => {
const res = await get('/llms.txt')
const content = res.body
// Should include translations with language codes
expect(content).toMatch(/## Translations/i)
expect(content).toMatch(/api\/pagelist\/[a-z]{2}\/free-pro-team@latest/i)
// Extract translation section
const translationsMatch = content.match(/## Translations\n([\s\S]*?)(?=\n## |$)/)
expect(translationsMatch).toBeTruthy()
if (translationsMatch) {
const translationsSection = translationsMatch[1]
const languageLinks = translationsSection.match(/- \[.*?\]\(.*?\)/g)
expect(languageLinks).toBeTruthy()
expect(languageLinks!.length).toBeGreaterThan(5) // Should have multiple languages
}
})
test.each(langs)('includes %s language with proper formatting', async (lang) => {
const res = await get('/llms.txt')
const content = res.body
// Should include this language with proper markdown link format
expect(content).toMatch(
new RegExp(`\\[.*?\\]\\(.*?api/pagelist/${lang}/free-pro-team@latest\\)`),
)
})
})