Skip to content

Commit 422a973

Browse files
haraldschillyclaude
andcommitted
backend/conat/test: replace toThrowError with toThrow per Jest v30 migration
Jest v30 removed the toThrowError matcher. Following the official migration guide, all instances have been replaced with the equivalent toThrow matcher. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8cbd0c8 commit 422a973

File tree

10 files changed

+625
-722
lines changed

10 files changed

+625
-722
lines changed

src/packages/backend/conat/test/core/basic.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe("basic test of publish and subscribe", () => {
101101
const sub1 = await cn.subscribe(subject);
102102
await expect(async () => {
103103
await cn.subscribe(subject, { queue: "xxx" });
104-
}).rejects.toThrowError("one queue group");
104+
}).rejects.toThrow("one queue group");
105105

106106
sub1.stop();
107107
// now this works
@@ -259,7 +259,7 @@ describe("basic tests of request/respond", () => {
259259
it("call the iter server -- test that throws an error", async () => {
260260
await expect(async () => {
261261
await callIter(c1, null);
262-
}).rejects.toThrowError("is not iterable");
262+
}).rejects.toThrow("is not iterable");
263263
});
264264
});
265265

src/packages/backend/conat/test/core/core-stream-break.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("stop persist server, create a client, create an ephemeral core-stream,
6565

6666
await expect(async () => {
6767
await stream.publish("y", { timeout: 100 });
68-
}).rejects.toThrowError();
68+
}).rejects.toThrow();
6969

7070
try {
7171
await stream.publish("y", { timeout: 100 });

src/packages/backend/conat/test/core/core-stream.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe("create a client, create an ephemeral core-stream, and do basic tests",
6060
it("publishing undefined is not allowed", async () => {
6161
await expect(
6262
async () => await stream.publish(undefined),
63-
).rejects.toThrowError("must not be 'undefined'");
63+
).rejects.toThrow("must not be 'undefined'");
6464
});
6565

6666
it("a second client has the same messages", async () => {
@@ -307,7 +307,7 @@ describe("test previousSeq when setting keys, which can be used to ensure consis
307307
it("tries to change the value using the wrong previousSeq", async () => {
308308
await expect(async () => {
309309
await stream.setKv("my", "newval", { previousSeq: 0 });
310-
}).rejects.toThrowError("wrong last sequence");
310+
}).rejects.toThrow("wrong last sequence");
311311
});
312312

313313
it("changes the value using the correct previousSeq", async () => {
@@ -398,7 +398,7 @@ describe("test permissions", () => {
398398
// they give the project_id, not their id.
399399
await expect(async () => {
400400
await stream.init();
401-
}).rejects.toThrowError("permission denied");
401+
}).rejects.toThrow("permission denied");
402402

403403
stream.close();
404404
});
@@ -415,7 +415,7 @@ describe("test permissions", () => {
415415
stream.storage.path = "hub/conat2.ipynb";
416416
await expect(async () => {
417417
await stream.init();
418-
}).rejects.toThrowError("permission denied");
418+
}).rejects.toThrow("permission denied");
419419
stream.close();
420420

421421
stream = new CoreStream({
@@ -429,7 +429,7 @@ describe("test permissions", () => {
429429
stream.user = { project_id: "00000000-0000-4000-8000-000000000004" };
430430
await expect(async () => {
431431
await stream.init();
432-
}).rejects.toThrowError("permission denied");
432+
}).rejects.toThrow("permission denied");
433433
stream.close();
434434

435435
stream = new CoreStream({
@@ -442,7 +442,7 @@ describe("test permissions", () => {
442442
stream.user = { account_id: "00000000-0000-4000-8000-000000000000" };
443443
await expect(async () => {
444444
await stream.init();
445-
}).rejects.toThrowError("permission denied");
445+
}).rejects.toThrow("permission denied");
446446

447447
stream.close();
448448
});

src/packages/backend/conat/test/core/services.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe("more service tests", () => {
100100
});
101101
await expect(async () => {
102102
await arith.mul(2, 3);
103-
}).rejects.toThrowError("no subscribers");
103+
}).rejects.toThrow("no subscribers");
104104
});
105105

106106
it("cleans up", () => {

src/packages/backend/conat/test/core/wait-for-interest.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("test waitForInterest with request", () => {
3535
it("request throws an error by default if there is no listener", async () => {
3636
expect(async () => {
3737
await client.request("eval.server.com", "2+3");
38-
}).rejects.toThrowError("no subscribers");
38+
}).rejects.toThrow("no subscribers");
3939
});
4040

4141
it("requests with waitForInterest set and sees it work", async () => {
@@ -54,7 +54,7 @@ describe("test waitForInterest with requestMany", () => {
5454
it("request throws an error by default if there is no listener", async () => {
5555
expect(async () => {
5656
await client.requestMany("arith.server.com", [2, 3]);
57-
}).rejects.toThrowError("no subscribers");
57+
}).rejects.toThrow("no subscribers");
5858
});
5959

6060
it("requestMany with waitForInterest set and sees it work", async () => {

src/packages/backend/conat/test/server/limits.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("test the per user subscription limit", () => {
2727
it("creates another subscription and gets an error", async () => {
2828
await expect(async () => {
2929
await client.sub("sub3");
30-
}).rejects.toThrowError("limit");
30+
}).rejects.toThrow("limit");
3131
});
3232

3333
it("cleans up", () => {

src/packages/backend/conat/test/service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("create a service and test it out", () => {
3838
s.close();
3939
await expect(async () => {
4040
await callConatService({ service: "echo", mesg: "hi", timeout: 250 });
41-
}).rejects.toThrowError("time");
41+
}).rejects.toThrow("time");
4242
});
4343
});
4444

@@ -275,7 +275,7 @@ describe("create a slow service and check that the timeout parameter works", ()
275275
mesg: 5000,
276276
timeout: 75,
277277
});
278-
}).rejects.toThrowError("imeout");
278+
}).rejects.toThrow("imeout");
279279
});
280280

281281
it("clean up", async () => {

src/packages/backend/conat/test/sync/akv.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe("test interop with a dkv", () => {
9191
it("check sqlite query fails", async () => {
9292
await expect(async () => {
9393
await akv.sqlite("SELECT count(*) AS n FROM messages");
94-
}).rejects.toThrowError("sqlite command not currently supported");
94+
}).rejects.toThrow("sqlite command not currently supported");
9595
});
9696

9797
// it("check sqlite query works", async () => {

src/packages/backend/conat/test/sync/limits.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe("create a dstream with limit on the total number of messages, and confi
246246
s.publish("x".repeat(70));
247247
await expect(async () => {
248248
await s.stream.publish("x".repeat(150));
249-
}).rejects.toThrowError("max_msg_size");
249+
}).rejects.toThrow("max_msg_size");
250250
await s.config({ max_msg_size: 200 });
251251
s.publish("x".repeat(150));
252252
await s.config({ max_msg_size: -1 });

0 commit comments

Comments
 (0)