- 插件包改为 .xuqm.zip 事务制品,manifest/bundle/资源/SHA-256 统一校验 - 原生层拆分为桥接编排、插件包暂存、底层存储三个单一职责类 - 状态查询改为纯读取,不再误触发安装;新增 NATIVE_BASELINE_INCOMPATIBLE 拒绝 - SemVer 解析拆分为独立原生类并补原生测试 - XWebView 收口唯一内核,错误态统一中文层与重试 - common 增加请求头/运行时契约收口与 http 测试
27 行
791 B
TypeScript
27 行
791 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { apiRequest, configureHttp } from '../src/http'
|
|
|
|
test('apiRequest aborts a stalled request at the shared timeout boundary', async () => {
|
|
const originalFetch = globalThis.fetch
|
|
configureHttp({ baseUrl: 'https://platform.example.test' })
|
|
globalThis.fetch = async (_input, init) =>
|
|
new Promise((_resolve, reject) => {
|
|
init?.signal?.addEventListener(
|
|
'abort',
|
|
() => reject(init.signal?.reason ?? new Error('aborted')),
|
|
{ once: true },
|
|
)
|
|
})
|
|
|
|
try {
|
|
await assert.rejects(
|
|
() => apiRequest('/api/v1/rn/release-set/check', { skipAuth: true, timeoutMs: 5 }),
|
|
/Request timed out after 5ms/,
|
|
)
|
|
} finally {
|
|
globalThis.fetch = originalFetch
|
|
}
|
|
})
|