test(web): align source assertions with i18n

This commit is contained in:
yibaiba committed 2026-09-09 09:59:03 +08:00
1 parent 6468ae4e57
commit 9baf96f4e8
2 files changed
+10 -5

No files matched your search

+7 -4
View File
@@ -7,7 +7,7 @@ async function source(path: string) {
}
test('production Vue surfaces present the HiDeck brand consistently', async () => {
const [app, shell, login, loading, header, commands, automation, settings, atConsole] = await Promise.all([
const [app, shell, login, loading, header, commands, automation, settings, atConsole, zhCN] = await Promise.all([
source('../src/App.vue'),
source('../src/layouts/AuthenticatedShell.vue'),
source('../src/views/Login.vue'),
@@ -16,7 +16,8 @@ test('production Vue surfaces present the HiDeck brand consistently', async () =
source('../src/components/commands/CommandChat.vue'),
source('../src/views/AutomaticTasks.vue'),
source('../src/views/Settings.vue'),
source('../src/components/DeviceAtTab.vue')
source('../src/components/DeviceAtTab.vue'),
source('../src/i18n/zh-CN.ts')
])
const visibleSources = [app, shell, login, loading, header, commands, automation, settings, atConsole]
@@ -27,8 +28,10 @@ test('production Vue surfaces present the HiDeck brand consistently', async () =
assert.match(shell, /sidebar-brand-title">HiDeck</)
assert.match(shell, /topbar-product">HIDECK</)
assert.match(login, /identity-mark">H</)
assert.match(login, /登录 HiDeck/)
assert.match(app, /HiDeck 最终用户许可与免责声明/)
assert.match(login, /t\('login\.title'\)/)
assert.match(zhCN, /login:\s*\{[\s\S]*?title:\s*'登录 HiDeck'/)
assert.match(app, /t\('disclaimer\.title'\)/)
assert.match(zhCN, /disclaimer:\s*\{[\s\S]*?title:\s*'HiDeck 最终用户许可与免责声明'/)
assert.match(commands, /HiDeck 命令会话/)
assert.match(settings, /title="HiDeck Gateway"/)
})
+3 -1
View File
@@ -14,11 +14,13 @@ const contactService = await readFile(new URL('../src/services/phone-contacts.ts
const phoneIdentity = await readFile(new URL('../src/composables/usePhoneIdentity.ts', import.meta.url), 'utf8')
const shell = await readFile(new URL('../src/layouts/AuthenticatedShell.vue', import.meta.url), 'utf8')
const router = await readFile(new URL('../src/router/index.ts', import.meta.url), 'utf8')
const zhCN = await readFile(new URL('../src/i18n/zh-CN.ts', import.meta.url), 'utf8')
test('phone route and navigation remain available outside the phone page', () => {
assert.match(router, /path: '\/phone'/)
assert.match(shell, /<PhoneCallBar\s*\/>/)
assert.match(shell, /index: '\/phone', label: '电话'/)
assert.match(shell, /index: '\/phone', label: t\('nav\.phone'\)/)
assert.match(zhCN, /phone:\s*'电话'/)
assert.match(shell, /v-for="item in mobileMenuItems"/)
})