-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy patherror_resilience.test.ts
More file actions
40 lines (30 loc) · 1.47 KB
/
error_resilience.test.ts
File metadata and controls
40 lines (30 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
import { describe, expect, it } from "vitest";
import { createSdkTestContext } from "./harness/sdkTestContext";
describe("Error Resilience", async () => {
const { copilotClient: client } = await createSdkTestContext();
it("should throw when sending to destroyed session", async () => {
const session = await client.createSession();
await session.destroy();
await expect(session.sendAndWait({ prompt: "Hello" })).rejects.toThrow();
});
it("should throw when getting messages from destroyed session", async () => {
const session = await client.createSession();
await session.destroy();
await expect(session.getMessages()).rejects.toThrow();
});
it("should handle double abort without error", async () => {
const session = await client.createSession();
// First abort should be fine
await session.abort();
// Second abort should not throw
await session.abort();
// Session should still be destroyable
await session.destroy();
});
it("should throw when resuming non-existent session", async () => {
await expect(client.resumeSession("non-existent-session-id-12345")).rejects.toThrow();
});
});