Files
hideck/web/tests/utServicesLayoutSource.test.ts
T
yibaiba 40dbc7cf31 feat(ut): add Vodafone xcap PDN and hide 呼叫设置
Why: Ut is HTTPS to an operator-internal IPv4 XCAP host, not SIP. IMS IPv6-only could not reach it, and CS-only devices still opened the page and waited on 502.

Why this works: Vodafone UK starts a second SWu session with APN xcap and omits INITIAL_CONTACT. Errors no longer leak the XCAP URL. The sidebar drops 呼叫设置; /ut redirects home.

Remaining: the xcap PDN gets IPv4, but TCP to the XCAP address still times out.
2026-09-01 12:26:23 +08:00

57 lines
2.3 KiB
TypeScript

import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
const utServices = await readFile(
new URL('../src/views/UtServices.vue', 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'
)
test('Ut services reads callService payloads from data, not value', () => {
assert.match(utServices, /result\.data\.devices/)
assert.match(utServices, /applyDoc\(result\.data\)/)
assert.doesNotMatch(utServices, /result\.value/)
})
test('Ut services uses the shared workspace, Element Plus controls, and error surface', () => {
assert.match(utServices, /<PageHeader title="呼叫设置"/)
assert.match(utServices, /class="ut-workspace ui-card ui-workspace-glow"/)
assert.match(utServices, /<ErrorState/)
assert.match(utServices, /title="呼叫设置不可用"/)
assert.match(utServices, /<el-select/)
assert.match(utServices, /<el-switch/)
assert.match(utServices, /<el-input/)
assert.match(utServices, /<el-button type="primary"/)
assert.match(utServices, /createLatestRequestGate/)
assert.doesNotMatch(utServices, /补充业务/)
assert.doesNotMatch(utServices, /<select |<input type="checkbox"|class="ut-btn"|class="ut-card"/)
})
test('sidebar hides 呼叫设置 until Ut/XCAP is reachable', () => {
assert.doesNotMatch(shell, /index: '\/ut', label: '呼叫设置'/)
assert.doesNotMatch(shell, /补充业务/)
assert.match(router, /path: '\/ut'[\s\S]*?redirect: '\/'/)
})
test('Ut services only lists software IMS WiFi calling devices', () => {
assert.match(utServices, /deviceSupportsUt/)
assert.match(utServices, /没有使用 WiFi calling 的设备/)
assert.match(utServices, /all\.filter\(deviceSupportsUt\)/)
})
test('Ut setting rows stay touch-safe and reduced-motion compatible', () => {
assert.match(utServices, /\.ut-setting-row \{[^}]*min-height: 72px/)
assert.match(utServices, /\.ut-setting-row :deep\(\.el-switch\) \{[^}]*min-width: 44px;[^}]*min-height: 44px/)
assert.match(utServices, /@media \(prefers-reduced-motion: reduce\)[\s\S]*animation: none/)
assert.match(utServices, /var\(--ui-text\)/)
assert.match(utServices, /var\(--ui-surface-strong\)/)
})