25 行
995 B
TypeScript
25 行
995 B
TypeScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
import { normalizeRemoteConfig, parseCachedRemoteConfig } from '../src/remoteConfig'
|
||
|
|
|
||
|
|
test('platform update feature is authoritative over the flat compatibility field', () => {
|
||
|
|
assert.equal(
|
||
|
|
normalizeRemoteConfig({ features: { update: false }, updateEnabled: true }).updateEnabled,
|
||
|
|
false,
|
||
|
|
)
|
||
|
|
assert.equal(normalizeRemoteConfig({ updateEnabled: true }).updateEnabled, true)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('missing update feature stays absent so XuqmConfig can safely default it off', () => {
|
||
|
|
assert.equal(normalizeRemoteConfig({}).updateEnabled, undefined)
|
||
|
|
assert.deepEqual(parseCachedRemoteConfig({ apiUrl: 'https://api.example.test' }), {
|
||
|
|
apiUrl: 'https://api.example.test',
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|
||
|
|
test('cached update availability is preserved exactly', () => {
|
||
|
|
assert.equal(parseCachedRemoteConfig({ updateEnabled: true })?.updateEnabled, true)
|
||
|
|
assert.equal(parseCachedRemoteConfig({ updateEnabled: false })?.updateEnabled, false)
|
||
|
|
})
|