This commit is contained in:
2026-09-20 14:22:17 +08:00
parent 69521095e8
commit 3ba8809222
5 changed files with 29 additions and 4 deletions
+13
View File
@@ -31,6 +31,19 @@ test('overseas online update supports mandatory APK and wgt installation flows',
assert.match(updater, /if \(retry\) await runUpdate\(update\)/)
})
test('overseas update manifest rejects a domestic AppID and incompatible WGT base', async () => {
const updater = await read('../src/utils/app-update.js')
const body = updater.match(/function normalizeUpdate\(payload, runtime\) \{[\s\S]*?\n\}/)?.[0]
assert.ok(body)
const normalize = new Function(`${body}; return normalizeUpdate`)()
const runtime = { appid: 'overseas-app', appVersionCode: 3 }
const manifest = { update: true, appid: 'overseas-app', packageType: 'wgt', downloadUrl: 'https://example.com/app.wgt', versionName: '1.0.4', minAppVersionCode: 3 }
assert.equal(normalize(manifest, runtime).minAppVersionCode, 3)
assert.throws(() => normalize({ ...manifest, appid: 'domestic-app' }, runtime), /不匹配/)
assert.throws(() => normalize({ ...manifest, minAppVersionCode: 4 }, runtime), /新版 APK/)
assert.throws(() => normalize({ ...manifest, minAppVersionCode: undefined }, runtime), /新版 APK/)
})
test('overseas profile exposes manual App update checking and the runtime version', async () => {
const profile = await read('../src/pages/profile/profile.vue')