XuqmGroup-RNSDK/packages/common/tests/lifecycle.test.ts
XuqmGroup 507ce3d2ee feat(update): release-set 事务制品与原生层职责拆分
- 插件包改为 .xuqm.zip 事务制品,manifest/bundle/资源/SHA-256 统一校验
- 原生层拆分为桥接编排、插件包暂存、底层存储三个单一职责类
- 状态查询改为纯读取,不再误触发安装;新增 NATIVE_BASELINE_INCOMPATIBLE 拒绝
- SemVer 解析拆分为独立原生类并补原生测试
- XWebView 收口唯一内核,错误态统一中文层与重试
- common 增加请求头/运行时契约收口与 http 测试
2026-07-20 19:31:43 +08:00

34 行
930 B
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import {
_notifyInitialized,
_registerInitializationHandler,
getConfig,
initConfigFromRemote,
} from '../src/config'
test('all extensions observe the same initialized config exactly once', async () => {
const observed: string[] = []
const unregister = _registerInitializationHandler('test-extension', config => {
observed.push(`${config.appKey}:${config.apiUrl}`)
})
initConfigFromRemote(
{
appKey: 'shared-app',
platformUrl: 'https://platform.example.test',
},
{
apiUrl: 'https://api.example.test',
imApiUrl: 'https://im.example.test',
},
)
await _notifyInitialized()
assert.equal(getConfig().apiUrl, 'https://api.example.test')
assert.equal(getConfig().platformUrl, 'https://platform.example.test')
assert.deepEqual(observed, ['shared-app:https://api.example.test'])
unregister()
})