更新依赖,优化认证流程;添加聊天框动画效果,优化消息处理逻辑
This commit is contained in:
@@ -78,4 +78,23 @@ describe("streamCopilotChat", () => {
|
||||
{ type: "error", message: "stream request failed", detail: "bad request" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("emits re-login message on unauthorized response", async () => {
|
||||
apiFetch.mockResolvedValue({
|
||||
ok: false,
|
||||
status: 401,
|
||||
body: null,
|
||||
text: async () => "unauthorized",
|
||||
});
|
||||
|
||||
const events: Array<{ type: string; message?: string; detail?: string }> = [];
|
||||
await streamCopilotChat({
|
||||
message: "hi",
|
||||
onEvent: (event) => events.push(event),
|
||||
});
|
||||
|
||||
expect(events).toEqual([
|
||||
{ type: "error", message: "Login expired. Please sign in again.", detail: undefined },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user