Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2import type {
3 ApplicationStoredEvent,
4 OrchestrationV2ShellSnapshot,
5 OrchestrationV2ShellStreamItem,
6 OrchestrationV2ThreadShell,
7} from "@t3tools/contracts";
8import { ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
9import type * as Cause from "effect/Cause";
10import * as DateTime from "effect/DateTime";
11import * as Deferred from "effect/Deferred";
12import * as Duration from "effect/Duration";
13import * as Effect from "effect/Effect";
14import * as PubSub from "effect/PubSub";
15import * as Queue from "effect/Queue";
16import * as Stream from "effect/Stream";
17import * as TestClock from "effect/testing/TestClock";
18
19import {
20 activeShellRowsForSubscriber,
21 bufferShellLiveStream,
22 composeShellStreamWithEnrichment,
23 dedupeShellEnrichment,
24 omitIdleSubagentShells,
25 omitOlderSettledShells,
26 shellStreamItemFromEnrichmentRefresh,
27 shellStreamItemsFromInitialSnapshot,
28 shouldPublishShellApplicationEvent,
29 skipUnchangedThreadShells,
30} from "./ShellStream.ts";
31
32const emptyShellSnapshot = {
33 schemaVersion: 1,
34 snapshotSequence: 0,
35 projects: [],
36 threads: [],
37 archivedThreads: [],
38} as OrchestrationV2ShellSnapshot;
39
40describe("subagent shell events", () => {
41 const stored = (threadId: string, type: string) =>
42 ({ event: { threadId, type } }) as ApplicationStoredEvent;
43
44 it("keeps regular threads and subagent state changes while omitting subagent transcript updates", () => {
45 const subagents = new Set(["child"]);
46 expect(
47 shouldPublishShellApplicationEvent(stored("parent", "turn-item.updated"), subagents),
48 ).toBe(true);
49 expect(
50 shouldPublishShellApplicationEvent(stored("child", "turn-item.updated"), subagents),
51 ).toBe(false);
52 expect(shouldPublishShellApplicationEvent(stored("child", "node.updated"), subagents)).toBe(
53 false,
54 );
55 expect(
56 shouldPublishShellApplicationEvent(stored("child", "runtime-request.updated"), subagents),
57 ).toBe(true);
58 expect(shouldPublishShellApplicationEvent(stored("child", "run.updated"), subagents)).toBe(
59 true,
60 );
61 });
62
63 it("tracks subagents created after the subscription starts", () => {
64 const subagents = new Set<string>();
65 const created = {
66 event: {
67 threadId: "new-child",
68 type: "thread.created",
69 payload: { lineage: { relationshipToParent: "subagent" } },
70 },
71 } as ApplicationStoredEvent;
72 expect(shouldPublishShellApplicationEvent(created, subagents)).toBe(true);
73 expect(
74 shouldPublishShellApplicationEvent(stored("new-child", "message.updated"), subagents),
75 ).toBe(false);
76 expect(
77 shouldPublishShellApplicationEvent(stored("new-child", "thread.deleted"), subagents),
78 ).toBe(true);
79 expect(subagents.has("new-child")).toBe(true);
80 });
81});
82
83it.effect("coalesces a slow shell subscriber by identity and location in sequence order", () =>
84 Effect.scoped(
85 Effect.gen(function* () {
86 const input = yield* Queue.unbounded<
87 Extract<OrchestrationV2ShellStreamItem, { readonly sequence: number }>,
88 Cause.Done
89 >();
90 const drained = yield* Deferred.make<void>();
91 const shell = shellFixture({ id: ThreadId.make("same"), title: "Before" });
92 const project = {
93 id: ProjectId.make("same"),
94 title: "Before",
95 workspaceRoot: "/workspace/same",
96 repositoryIdentity: null,
97 defaultModelSelection: null,
98 scripts: [],
99 createdAt: "2026-09-01T00:00:00Z",
100 updatedAt: "2026-09-01T00:00:00Z",
101 };
102 const initial = {
103 kind: "thread.updated" as const,
104 sequence: 1,
105 location: "active" as const,
106 thread: shell,
107 };
108 const updates = [
109 { kind: "project.updated", sequence: 2, project },
110 { ...initial, sequence: 3 },
111 { ...initial, sequence: 4, location: "archive" },
112 { ...initial, sequence: 5, thread: { ...shell, id: ThreadId.make("other") } },
113 {
114 kind: "project.updated",
115 sequence: 6,
116 project: { ...project, id: ProjectId.make("other") },
117 },
118 { kind: "project.removed", sequence: 7, projectId: project.id },
119 { kind: "thread.removed", sequence: 8, location: "active", threadId: shell.id },
120 { kind: "project.updated", sequence: 9, project: { ...project, title: "Recreated" } },
121 { ...initial, sequence: 10, thread: { ...shell, title: "Recreated" } },
122 { kind: "thread.removed", sequence: 11, location: "archive", threadId: shell.id },
123 ] satisfies Array<Extract<OrchestrationV2ShellStreamItem, { readonly sequence: number }>>;
124 const pull = yield* Stream.toPull(
125 bufferShellLiveStream(
126 Stream.fromQueue(input).pipe(Stream.ensuring(Deferred.succeed(drained, undefined))),
127 { maxItems: 6, maxSerializedBytes: 1_500 },
128 ),
129 );
130 yield* Queue.offer(input, initial);
131 expect(yield* pull).toEqual([initial]);
132 yield* Queue.offerAll(input, updates);
133 yield* Queue.end(input);
134 // Finish producing the burst while the first batch is still awaiting its ACK.
135 yield* Deferred.await(drained);
136 expect(yield* pull).toEqual([updates[3], updates[4], updates[7], updates[8], updates[9]]);
137 }),
138 ),
139);
140
141function shellFixture(overrides: Partial<OrchestrationV2ThreadShell>): OrchestrationV2ThreadShell {
142 return { id: "thread-a", archivedAt: null, ...overrides } as OrchestrationV2ThreadShell;
143}
144
145describe("omitIdleSubagentShells", () => {
146 const row = (
147 id: string,
148 parent: string | null,
149 overrides: Partial<OrchestrationV2ThreadShell> = {},
150 ) =>
151 shellFixture({
152 id: ThreadId.make(id),
153 lineage: {
154 parentThreadId: parent === null ? null : ThreadId.make(parent),
155 relationshipToParent: parent === null ? null : "subagent",
156 rootThreadId: ThreadId.make("root"),
157 },
158 status: "completed",
159 activityRunStatus: null,
160 pendingRuntimeRequest: null,
161 pendingBackgroundTasks: [],
162 ...overrides,
163 });
164
165 it("drops idle leaf children but keeps live ones and the middle of nested chains", () => {
166 const threads = [
167 row("root", null),
168 row("idle", "root"),
169 row("running", "root", { activityRunStatus: "running" }),
170 row("queued", "root", { status: "queued" }),
171 row("asking", "root", {
172 pendingRuntimeRequest: {
173 id: "request" as never,
174 kind: "user_input",
175 createdAt: DateTime.makeUnsafe(0),
176 },
177 }),
178 row("background", "root", {
179 pendingBackgroundTasks: [{ kind: "subagent" } as never],
180 }),
181 // Idle, but a woken grandchild walks through it to reach the root's badge.
182 row("middle", "root"),
183 row("grandchild", "middle"),
184 ];
185 expect(omitIdleSubagentShells(threads).map((thread) => thread.id)).toEqual([
186 "root",
187 "running",
188 "queued",
189 "asking",
190 "background",
191 "middle",
192 ]);
193 });
194
195 it("still filters the transcript events of omitted children for a subscriber that opts in", () => {
196 const threads = [row("root", null), row("idle", "root")];
197 const omitted = activeShellRowsForSubscriber(threads, true);
198 expect(omitted.threads.map((thread) => thread.id)).toEqual(["root"]);
199 expect(
200 shouldPublishShellApplicationEvent(
201 { event: { threadId: "idle", type: "turn-item.updated" } } as ApplicationStoredEvent,
202 omitted.subagentThreadIds,
203 ),
204 ).toBe(false);
205 });
206});
207
208describe("omitOlderSettledShells", () => {
209 const DAY = 24 * 60 * 60 * 1000;
210 const now = DateTime.makeUnsafe(100 * DAY);
211 const row = (
212 id: string,
213 settledDaysAgo: number | null,
214 overrides: Partial<OrchestrationV2ThreadShell> = {},
215 ) =>
216 shellFixture({
217 id: ThreadId.make(id),
218 projectId: ProjectId.make(id.startsWith("b-") ? "project-b" : "project-a"),
219 lineage: {
220 parentThreadId: null,
221 relationshipToParent: null,
222 rootThreadId: ThreadId.make(id),
223 },
224 status: "completed",
225 activityRunStatus: null,
226 pendingRuntimeRequest: null,
227 pendingBackgroundTasks: [],
228 settledOverride: settledDaysAgo === null ? null : "settled",
229 settledAt:
230 settledDaysAgo === null ? null : DateTime.makeUnsafe(100 * DAY - settledDaysAgo * DAY),
231 ...overrides,
232 });
233 const newest = Array.from({ length: 25 }, (_, index) => row(`new-${index}`, index / 10));
234 const omit = (threads: ReadonlyArray<OrchestrationV2ThreadShell>) =>
235 omitOlderSettledShells({ threads, snapshotSequence: 7, now });
236
237 it("keeps the 25 newest settled threads and counts the rest per project", () => {
238 const result = omit([...newest, row("old", 30), row("b-old", 40), row("unsettled", null)]);
239 expect(result.threads.map((thread) => thread.id)).toEqual([
240 ...newest.map((thread) => thread.id),
241 "unsettled",
242 ]);
243 expect(result.olderSettled).toEqual({
244 before: DateTime.formatIso(DateTime.makeUnsafe(100 * DAY - 2.4 * DAY)),
245 asOfSequence: 7,
246 counts: [
247 { projectId: "project-a", count: 1 },
248 { projectId: "project-b", count: 1 },
249 ],
250 });
251 });
252
253 it("keeps threads tied with the 25th newest", () => {
254 const result = omit([...newest, row("tie", 2.4), row("older", 2.5)]);
255 expect(result.threads.map((thread) => thread.id).slice(25)).toEqual(["tie"]);
256 });
257
258 it("omits nothing with fewer than 25 settled threads, however old", () => {
259 const old = Array.from({ length: 5 }, (_, index) => row(`old-${index}`, 300 + index));
260 const result = omit(old);
261 expect(result.threads).toEqual(old);
262 expect(result.olderSettled.counts).toEqual([]);
263 });
264
265 it("keeps older rows that are snoozed, live, or above a kept subagent, and still counts them", () => {
266 const threads = [
267 ...newest,
268 row("snoozed", 30, { snoozedUntil: DateTime.makeUnsafe(101 * DAY) }),
269 row("woke", 30, { snoozedUntil: DateTime.makeUnsafe(99 * DAY) }),
270 row("running", 30, { activityRunStatus: "running" }),
271 row("parent", 30),
272 shellFixture({
273 id: ThreadId.make("child"),
274 projectId: ProjectId.make("project-a"),
275 lineage: {
276 parentThreadId: ThreadId.make("parent"),
277 relationshipToParent: "subagent",
278 rootThreadId: ThreadId.make("parent"),
279 },
280 settledOverride: null,
281 settledAt: null,
282 }),
283 ];
284 const result = omit(threads);
285 expect(result.threads.map((thread) => thread.id).slice(25)).toEqual([
286 "snoozed",
287 "running",
288 "parent",
289 "child",
290 ]);
291 expect(result.olderSettled.counts).toEqual([{ projectId: "project-a", count: 4 }]);
292 });
293});
294
295describe("shellStreamItemsFromInitialSnapshot", () => {
296 it("keeps thread rows out of the metadata-only enrichment frame", () => {
297 const snapshot = {
298 ...emptyShellSnapshot,
299 projects: [
300 { id: "project-a", workspaceRoot: "/workspace/a" },
301 { id: "project-b", workspaceRoot: "/workspace/b" },
302 ],
303 threads: [shellFixture({})],
304 archivedThreads: [shellFixture({ id: ThreadId.make("thread-archived"), archivedAt: null })],
305 } as unknown as OrchestrationV2ShellSnapshot;
306
307 const items = shellStreamItemsFromInitialSnapshot({
308 snapshot,
309 resolvedRepositoryIdentityRoots: ["/workspace/a"],
310 });
311
312 expect(items[0]).toEqual({ kind: "snapshot", snapshot });
313 expect(items[1]).toMatchObject({
314 kind: "snapshot",
315 snapshot: {
316 projects: [{ id: "project-a", workspaceRoot: "/workspace/a" }],
317 threads: [],
318 archivedThreads: [],
319 },
320 resolvedRepositoryIdentityRoots: ["/workspace/a"],
321 });
322 expect(JSON.stringify(items[1]).length).toBeLessThan(JSON.stringify(items[0]).length);
323 });
324});
325
326describe("composeShellStreamWithEnrichment", () => {
327 it.effect("preserves pending repository resolutions while an enrichment ACK is withheld", () =>
328 Effect.scoped(
329 Effect.gen(function* () {
330 // Match ProjectEnrichmentService's sliding notifications and the WS batching path.
331 const changes = yield* Effect.acquireRelease(
332 PubSub.sliding<{ readonly workspaceRoot: string }>(256),
333 PubSub.shutdown,
334 );
335 const subscription = yield* PubSub.subscribe(changes);
336 const pull = yield* Stream.toPull(
337 composeShellStreamWithEnrichment({
338 initial: Stream.empty,
339 tail: Stream.empty,
340 enrichment: Stream.fromSubscription(subscription).pipe(
341 Stream.groupedWithin(64, Duration.millis(25)),
342 Stream.map((changes) =>
343 shellStreamItemFromEnrichmentRefresh({
344 snapshot: emptyShellSnapshot,
345 changes,
346 }),
347 ),
348 ),
349 }),
350 );
351
352 const firstRoots = Array.from({ length: 64 }, (_, index) => `/workspace/first-${index}`);
353 yield* PubSub.publishAll(
354 changes,
355 firstRoots.map((workspaceRoot) => ({ workspaceRoot })),
356 );
357 expect(yield* pull).toMatchObject([{ resolvedRepositoryIdentityRoots: firstRoots }]);
358
359 // The next completion can be batched before the client acknowledges the first.
360 yield* PubSub.publish(changes, { workspaceRoot: "/workspace/pending" });
361 yield* Effect.yieldNow;
362 yield* TestClock.adjust(Duration.millis(25));
363 const laterRoots = Array.from({ length: 256 }, (_, index) => `/workspace/later-${index}`);
364 yield* PubSub.publishAll(
365 changes,
366 laterRoots.map((workspaceRoot) => ({ workspaceRoot })),
367 );
368
369 const resumed = yield* Stream.fromPull(Effect.succeed(pull)).pipe(
370 Stream.takeUntil(
371 (item) =>
372 item.resolvedRepositoryIdentityRoots?.includes("/workspace/later-255") ?? false,
373 ),
374 Stream.runCollect,
375 );
376 expect(resumed.flatMap((item) => item.resolvedRepositoryIdentityRoots ?? [])).toEqual([
377 "/workspace/pending",
378 ...laterRoots,
379 ]);
380 }),
381 ),
382 );
383
384 it.effect("keeps a merged shell batch charged while the client withholds its ACK", () =>
385 Effect.scoped(
386 Effect.gen(function* () {
387 const update = yield* Deferred.make<void>();
388 const closed = yield* Deferred.make<void>();
389 const initial = {
390 kind: "thread.removed" as const,
391 sequence: 1,
392 location: "active" as const,
393 threadId: ThreadId.make("thread-a"),
394 };
395 const pull = yield* Stream.toPull(
396 composeShellStreamWithEnrichment({
397 initial: Stream.empty,
398 tail: bufferShellLiveStream(
399 Stream.concat(
400 Stream.succeed(initial),
401 Stream.fromEffect(Deferred.await(update)).pipe(
402 Stream.map(() => ({ ...initial, sequence: 2 })),
403 ),
404 ).pipe(Stream.ensuring(Deferred.succeed(closed, undefined))),
405 { maxItems: 1 },
406 ),
407 enrichment: Stream.empty,
408 }),
409 );
410 expect(yield* pull).toEqual([initial]);
411 // Let the merge producer run while the client still withholds its ACK.
412 yield* Effect.yieldNow;
413 yield* Deferred.succeed(update, undefined);
414 yield* Deferred.await(closed);
415 const result = yield* Stream.fromPull(Effect.succeed(pull)).pipe(
416 Stream.runDrain,
417 Effect.result,
418 );
419 expect(result._tag).toBe("Failure");
420 if (result._tag === "Failure") expect(result.failure._tag).toBe("LiveStreamBufferError");
421 }),
422 ),
423 );
424
425 it.effect(
426 "emits every initial item before enrichment even when enrichment is already ready",
427 () =>
428 Effect.gen(function* () {
429 const initialSnapshot = {
430 ...emptyShellSnapshot,
431 snapshotSequence: 5,
432 } as OrchestrationV2ShellSnapshot;
433 const enrichmentSnapshot = {
434 ...emptyShellSnapshot,
435 snapshotSequence: 10,
436 } as OrchestrationV2ShellSnapshot;
437
438 const initialItems = shellStreamItemsFromInitialSnapshot({
439 snapshot: initialSnapshot,
440 resolvedRepositoryIdentityRoots: ["/workspace/a"],
441 });
442 const enrichment = Stream.make(
443 shellStreamItemFromEnrichmentRefresh({
444 snapshot: enrichmentSnapshot,
445 changes: [{ workspaceRoot: "/workspace/b" }],
446 }),
447 );
448 const tail = Stream.make(
449 { kind: "synchronized" as const },
450 {
451 kind: "project.removed" as const,
452 sequence: 6,
453 projectId: "project-a",
454 },
455 );
456
457 const items = Array.from(
458 yield* composeShellStreamWithEnrichment({
459 initial: Stream.fromIterable(initialItems),
460 tail,
461 enrichment,
462 }).pipe(Stream.runCollect),
463 );
464
465 expect(items.slice(0, initialItems.length)).toEqual(initialItems);
466
467 const enrichmentIndex = items.findIndex(
468 (item) =>
469 item.kind === "snapshot" &&
470 "resolvedRepositoryIdentityRoots" in item &&
471 item.resolvedRepositoryIdentityRoots?.includes("/workspace/b"),
472 );
473 expect(enrichmentIndex).toBeGreaterThanOrEqual(initialItems.length);
474
475 for (let index = 0; index < initialItems.length; index++) {
476 expect(items[index]).toEqual(initialItems[index]);
477 }
478 }),
479 );
480});
481
482describe("dedupeShellEnrichment", () => {
483 const project = {
484 id: ProjectId.make("project-a"),
485 title: "A project",
486 workspaceRoot: "/workspace/a",
487 repositoryIdentity: null,
488 defaultModelSelection: null,
489 scripts: [],
490 createdAt: "2026-09-01T00:00:00Z",
491 updatedAt: "2026-09-01T00:00:00Z",
492 };
493 const initial = {
494 kind: "snapshot" as const,
495 snapshot: { ...emptyShellSnapshot, projects: [project] },
496 };
497 const marked = { ...initial, resolvedRepositoryIdentityRoots: [project.workspaceRoot] };
498
499 it.effect(
500 "keeps initial/resume resolution and real changes but drops sequence-only repeats",
501 () =>
502 Effect.gen(function* () {
503 const repeated = {
504 ...marked,
505 snapshot: { ...marked.snapshot, snapshotSequence: 10, projects: [{ ...project }] },
506 };
507 const progressed = {
508 ...repeated,
509 resolvedRepositoryIdentityRoots: [project.workspaceRoot, "/workspace/b"],
510 };
511 const changed = {
512 ...progressed,
513 snapshot: { ...progressed.snapshot, projects: [{ ...project, title: "Renamed" }] },
514 };
515 const items = yield* Stream.make(
516 initial,
517 marked,
518 repeated,
519 progressed,
520 changed,
521 changed,
522 ).pipe(dedupeShellEnrichment, Stream.runCollect);
523 expect(items).toEqual([initial, marked, progressed, changed]);
524 const resumed = Stream.make(marked, repeated).pipe(dedupeShellEnrichment);
525 expect(yield* Stream.runCollect(resumed)).toEqual([marked]);
526 expect(yield* Stream.runCollect(resumed)).toEqual([marked]);
527 }),
528 );
529
530 it.effect("keeps authoritative snapshots and invalidates metadata after project deltas", () =>
531 Effect.gen(function* () {
532 const removed = { kind: "project.removed" as const, projectId: project.id, sequence: 2 };
533 const updated = { kind: "project.updated" as const, project, sequence: 3 };
534 const withThreads = {
535 ...marked,
536 snapshot: { ...marked.snapshot, threads: [shellFixture({})] },
537 };
538 const values = [
539 initial,
540 initial,
541 marked,
542 removed,
543 marked,
544 updated,
545 marked,
546 withThreads,
547 withThreads,
548 ];
549 expect(
550 yield* Stream.fromIterable(values).pipe(dedupeShellEnrichment, Stream.runCollect),
551 ).toEqual(values);
552 }),
553 );
554
555 it.effect(
556 "deduplicates across thread deltas without dropping those deltas or identity clears",
557 () =>
558 Effect.gen(function* () {
559 const delta = {
560 kind: "thread.removed" as const,
561 threadId: ThreadId.make("thread-a"),
562 location: "active" as const,
563 sequence: 2,
564 };
565 const resolved = {
566 ...marked,
567 snapshot: {
568 ...marked.snapshot,
569 projects: [
570 {
571 ...project,
572 repositoryIdentity: {
573 canonicalKey: "github.com/test/repo",
574 locator: {
575 source: "git-remote" as const,
576 remoteName: "origin",
577 remoteUrl: "https://github.com/test/repo.git",
578 },
579 },
580 },
581 ],
582 },
583 };
584 expect(
585 yield* Stream.make(marked, delta, marked, resolved, marked).pipe(
586 dedupeShellEnrichment,
587 Stream.runCollect,
588 ),
589 ).toEqual([marked, delta, resolved, marked]);
590 }),
591 );
592});
593
594describe("skipUnchangedThreadShells", () => {
595 const at = (ms: number) => DateTime.makeUnsafe(Date.parse("2026-10-01T00:00:00.000Z") + ms);
596 const shell = (
597 id: string,
598 overrides: Partial<OrchestrationV2ThreadShell> = {},
599 ): OrchestrationV2ThreadShell => ({
600 id: ThreadId.make(id),
601 projectId: ProjectId.make("project-a"),
602 title: "Thread",
603 providerInstanceId: ProviderInstanceId.make("codex"),
604 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
605 runtimeMode: "full-access",
606 interactionMode: "default",
607 worktreePath: null,
608 activeProviderThreadId: null,
609 lineage: { rootThreadId: ThreadId.make(id), parentThreadId: null, relationshipToParent: null },
610 forkedFrom: null,
611 createdBy: "user",
612 creationSource: "web",
613 activeRunId: null,
614 latestVisibleMessage: null,
615 hasActionableProposedPlan: false,
616 itemCount: 1,
617 visibleItemCount: 1,
618 branch: null,
619 status: "running",
620 pendingRuntimeRequest: null,
621 pendingBackgroundTasks: [],
622 latestRunId: null,
623 latestUserMessageAt: null,
624 createdAt: at(0),
625 updatedAt: at(0),
626 archivedAt: null,
627 settledOverride: null,
628 settledAt: null,
629 deletedAt: null,
630 ...overrides,
631 });
632 type Step =
633 | { readonly advanceMs: number }
634 | Exclude<OrchestrationV2ShellStreamItem, { readonly kind: "snapshot" | "synchronized" }>;
635 const updated = (sequence: number, thread: OrchestrationV2ThreadShell): Step => ({
636 kind: "thread.updated",
637 sequence,
638 location: "active",
639 thread,
640 });
641 const run = (steps: ReadonlyArray<Step>) =>
642 Stream.fromIterable(steps).pipe(
643 Stream.mapEffect((step) =>
644 "advanceMs" in step
645 ? TestClock.adjust(Duration.millis(step.advanceMs)).pipe(Effect.as(null))
646 : Effect.succeed(step),
647 ),
648 Stream.filter((item) => item !== null),
649 skipUnchangedThreadShells,
650 Stream.runCollect,
651 Effect.map((items) => Array.from(items, (item) => ("sequence" in item ? item.sequence : -1))),
652 );
653
654 it.effect("sends the next update after a removal", () =>
655 Effect.gen(function* () {
656 const sent = yield* run([
657 updated(1, shell("a")),
658 { kind: "thread.removed", sequence: 2, location: "active", threadId: ThreadId.make("a") },
659 updated(3, shell("a")),
660 ]);
661 expect(sent).toEqual([1, 2, 3]);
662 }),
663 );
664});