test(skill): cover exact-source install guidance

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
XiaoSeS 2026-09-04 13:54:15 +08:00
parent 857797f0cc
commit 1f2fe961c5
2 changed files with 15 additions and 1 deletions

View file

@ -67,7 +67,9 @@ test.describe('Public Skill Detail Anonymous Access (Real API)', () => {
expect(agentPrompt).toContain(`${registryUrl}/install/skillhub.md`)
expect(agentPrompt).toContain(skillhubCoordinate)
expect(agentPrompt).toContain(current.skill.version)
expect(agentPrompt).toContain('ask for my confirmation')
expect(agentPrompt).toContain('explain why and stop')
expect(agentPrompt).toContain('do not use another source')
expect(agentPrompt).not.toContain('fallback')
await page.getByRole('tab', { name: 'ClawHub CLI' }).click()

View file

@ -1,4 +1,6 @@
import { describe, expect, it } from 'vitest'
import skillGuide from '../docs/skill.md?raw'
import skillGuideTemplate from '../docs/skill.md.template?raw'
import en from './locales/en.json'
import ru from './locales/ru.json'
import zh from './locales/zh.json'
@ -25,12 +27,22 @@ describe('landing quick start locales', () => {
en.skillDetail.installForAgent.prompt,
ru.skillDetail.installForAgent.prompt,
]) {
expect(prompt).toContain('{{guideUrl}}')
expect(prompt).toContain('{{skill}}')
expect(prompt).toContain('{{version}}')
expect(prompt).not.toContain('fallback')
expect(prompt).not.toContain('备用公共')
expect(prompt).toMatch(/不要改用其他来源|do not use another source|не используйте другой источник/)
}
})
it('limits fallback to discovery in both served guide sources', () => {
for (const guide of [skillGuide, skillGuideTemplate]) {
expect(guide).toContain('Fallback is only appropriate for discovery requests')
expect(guide).toContain('For an exact coordinate or version request, report the failure and stop')
}
})
it('exposes CLI install command in both locales', () => {
expect(zh.landing.quickStart.tabs.cli).toBe('CLI')
expect(zh.landing.quickStart.cli.command).toBe('npm i -g @astron-team/skillhub')