Files
hideck/web/tests/phoneMode.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

40 lines
1.8 KiB
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { deviceSupportsUt, isNativeVoLTEMode, isWifiCallingEnabled, phoneModeCampsOnCell, phoneModeLabel } from '../src/utils/phoneMode'
test('native volte is only the volte phone mode', () => {
assert.equal(isNativeVoLTEMode('volte'), true)
assert.equal(isNativeVoLTEMode('cellular'), false)
assert.equal(isNativeVoLTEMode('wifi'), false)
})
test('volte and cellular camp on cell; wifi does not', () => {
assert.equal(phoneModeCampsOnCell('volte'), true)
assert.equal(phoneModeCampsOnCell('cellular'), true)
assert.equal(phoneModeCampsOnCell('wifi'), false)
assert.equal(phoneModeCampsOnCell(undefined), false)
})
test('wifi calling is only wifi mode with phone on', () => {
assert.equal(isWifiCallingEnabled('wifi', true), true)
assert.equal(isWifiCallingEnabled('volte', true), false)
assert.equal(isWifiCallingEnabled('cellular', true), false)
assert.equal(isWifiCallingEnabled('wifi', false), false)
})
test('phone mode labels', () => {
assert.equal(phoneModeLabel('volte'), 'VoLTE')
assert.equal(phoneModeLabel('cellular'), '蜂窝数据')
assert.equal(phoneModeLabel('wifi'), 'WiFi calling')
})
test('Ut is only for software IMS WiFi calling devices', () => {
assert.equal(deviceSupportsUt({ vowifi_enabled: true, phone_mode: 'wifi' }), true)
assert.equal(deviceSupportsUt({ vowifi_active: true, phone_mode: 'wifi' }), true)
assert.equal(deviceSupportsUt({ vowifi_enabled: true, phone_mode: 'cellular' }), true)
assert.equal(deviceSupportsUt({ vowifi_enabled: true, phone_mode: 'volte' }), false)
assert.equal(deviceSupportsUt({ vowifi_enabled: false, phone_mode: 'wifi' }), false)
assert.equal(deviceSupportsUt({ phone_mode: 'wifi' }), false)
assert.equal(deviceSupportsUt(undefined), false)
})