Skip to content

Commit e2efd56

Browse files
committed
test(web): migrate reconnect cases to notification service
1 parent 2436088 commit e2efd56

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

‎apps/web/src/components/ThreadNotificationCoordinator.badge.browser.test.ts‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,14 @@ it.each(["hasPendingApprovals", "hasPendingUserInput"] as const)(
261261
},
262262
};
263263
state.shells.set("one", shell({ id: "working" }, { id: "asking" }, { id: "offline" }, done));
264-
await app.render();
264+
app.start();
265265
using _timers = fakeTimers();
266266
state.shells.set("one", shell({ id: "working" }, asking, { id: "offline" }, done));
267-
await app.render();
268267
state.shells.set("one", {
269268
...shell({ id: "working" }, asking, { id: "offline" }, done),
270269
status: "cached",
271270
});
272-
await app.render();
271+
273272
const completed = {
274273
id: "working",
275274
latestTurn: { turnId: "turn", state: "completed", completedAt: "2026-09-13T07:05:00.000Z" },
@@ -278,18 +277,15 @@ it.each(["hasPendingApprovals", "hasPendingUserInput"] as const)(
278277
...shell(completed, asking, offline, done),
279278
status: "synchronizing",
280279
});
281-
await app.render();
282280
state.shells.set("one", shell(completed, asking, offline, done));
283-
await app.render();
281+
284282
expect(TestNotification.sent.map(({ title }) => title)).toEqual([
285283
"Approval needed",
286284
flag === "hasPendingApprovals" ? "Approval needed" : "Input needed",
287285
]);
288286
await vi.advanceTimersByTimeAsync(WORKING_EXIT_GRACE_MS);
289287
state.shells.set("one", { ...shell(completed, asking, offline, done), status: "cached" });
290-
await app.render();
291288
state.shells.set("one", shell(completed, asking, offline, done));
292-
await app.render();
293289
await vi.advanceTimersByTimeAsync(WORKING_EXIT_GRACE_MS);
294290
expect(TestNotification.sent.map(({ title }) => title)).toEqual([
295291
"Approval needed",
@@ -303,19 +299,16 @@ it.each([false, true])(
303299
"rechecks a pending completion after reconnect (continued: %s)",
304300
async (continued) => {
305301
await using app = setup();
306-
await app.render();
302+
app.start();
307303
using _timers = fakeTimers();
308304
const completed = shell({
309305
latestTurn: { turnId: "turn", state: "completed", completedAt: "2026-09-13T07:05:00.000Z" },
310306
});
311307
state.shells.set("one", completed);
312-
await app.render();
313308
state.shells.set("one", { ...completed, status: "cached" });
314-
await app.render();
315309
await vi.advanceTimersByTimeAsync(WORKING_EXIT_GRACE_MS);
316310
expect(TestNotification.sent).toEqual([]);
317311
state.shells.set("one", continued ? shell() : completed);
318-
await app.render();
319312
await vi.advanceTimersByTimeAsync(WORKING_EXIT_GRACE_MS);
320313
expect(TestNotification.sent.map(({ title }) => title)).toEqual(
321314
continued ? [] : ["Thread completed"],

0 commit comments

Comments
 (0)