feat: 完成全部接口替换为新后端接口
This commit is contained in:
@@ -173,7 +173,10 @@ test('环境配置:开发版默认本地,正式/体验/未知环境不回退
|
||||
|
||||
test('请求层:HTTP、业务错误、畸形响应、网络错误均拒绝,不当作空成功', async () => {
|
||||
useRows([]);
|
||||
assert.deepEqual(await apiRequest('/categories'), categories);
|
||||
assert.deepEqual(
|
||||
await apiRequest('/categories', { auth: 'none' }),
|
||||
categories,
|
||||
);
|
||||
assert.equal(requests[0].url, 'http://127.0.0.1:8800/api/v1/categories');
|
||||
for (const result of [
|
||||
{ statusCode: 404 },
|
||||
@@ -183,12 +186,18 @@ test('请求层:HTTP、业务错误、畸形响应、网络错误均拒绝,
|
||||
{ raw: '<html>error</html>' },
|
||||
]) {
|
||||
handler = () => result;
|
||||
await assert.rejects(apiRequest('/categories'), ApiRequestError);
|
||||
await assert.rejects(
|
||||
apiRequest('/categories', { auth: 'none' }),
|
||||
ApiRequestError,
|
||||
);
|
||||
}
|
||||
handler = () => {
|
||||
throw new Error('offline');
|
||||
};
|
||||
await assert.rejects(apiRequest('/categories'), /连接失败/);
|
||||
await assert.rejects(
|
||||
apiRequest('/categories', { auth: 'none' }),
|
||||
/连接失败/,
|
||||
);
|
||||
});
|
||||
|
||||
test('完整分页:121 条无遗漏,计数字符串保留精度,空数据正常结束', async () => {
|
||||
|
||||
Reference in New Issue
Block a user