认证超时用例断言精确到一条拒绝

- auth.suite:启动超时用例先断言恰好捕获 1 条拒绝,再断言它是含「检查登录状态超时」的 Error
- 原来的 some(...) 只看有没有命中,无关 unhandledrejection 会被这段捕获静默吞掉、测不出回归
This commit is contained in:
2026-10-02 13:06:30 +08:00
parent 74e7209c31
commit 3d4c42901c
@@ -131,16 +131,12 @@ export function registerAuthTests() {
return null;
});
await waitFor(
() =>
expect(
rejections.reasons.some(
(reason) =>
reason instanceof Error &&
reason.message.includes('检查登录状态超时'),
),
).toBe(true),
{ timeout: 20_000 },
await waitFor(() => expect(rejections.reasons).toHaveLength(1), {
timeout: 20_000,
});
expect(rejections.reasons[0]).toBeInstanceOf(Error);
expect((rejections.reasons[0] as Error).message).toContain(
'检查登录状态超时',
);
// 启动检查失败在改动前就会显示原因 + 重试按钮;上报是叠加的,不是替换。
expect(