@marimo-team/islands 0.25.3-dev402 → 0.25.3-dev409

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{ConnectedDataExplorerComponent-1DGGwl88.js → ConnectedDataExplorerComponent-DCW4bXq-.js} +1 -1
  2. package/dist/{ErrorBoundary-DfbzIKA3.js → ErrorBoundary-DvqXHbNZ.js} +1 -1
  3. package/dist/{chat-ui-r3PPIMn0.js → chat-ui-BGEXB6V4.js} +1354 -1320
  4. package/dist/{code-visibility-CXijswY7.js → code-visibility-U0UkDKVw.js} +1 -1
  5. package/dist/{common-Cm5ENbUw.js → common-DIbea_dy.js} +1 -1
  6. package/dist/{data-grid-overlay-editor-Dv0TkGKt.js → data-grid-overlay-editor-DfXNDUyH.js} +1 -1
  7. package/dist/{feedback-button-Xk-mOev4.js → feedback-button-MbaK_7gC.js} +2 -2
  8. package/dist/{glide-data-editor-DdxBDWAj.js → glide-data-editor-BFIyRGll.js} +3 -3
  9. package/dist/{globals-DR3VVkF6.js → globals-B19LJT4z.js} +1 -1
  10. package/dist/main.js +6160 -6141
  11. package/dist/{number-overlay-editor-Cc5gJryh.js → number-overlay-editor-VHIfift0.js} +1 -1
  12. package/dist/{process-output-39KkAXSF.js → process-output-BvCDoG-m.js} +14 -25
  13. package/dist/{reveal-component-Dm5K9KPi.js → reveal-component-2v0Bn3oO.js} +2 -2
  14. package/dist/{spec-Ww0JjShW.js → spec-DV8oNpRR.js} +46 -49
  15. package/dist/{semaphore-8KhQouXt.js → useDeepCompareMemoize-C90a6_io.js} +15 -5
  16. package/dist/{vega-component-DQZhTzVQ.js → vega-component-ArEoBGzQ.js} +197 -198
  17. package/package.json +1 -1
  18. package/src/components/chat/__tests__/chat-utils.test.ts +48 -0
  19. package/src/components/chat/__tests__/message-queue.test.tsx +94 -1
  20. package/src/components/chat/__tests__/pending-chat-prompt.test.tsx +568 -0
  21. package/src/components/chat/__tests__/useFileState.test.tsx +176 -15
  22. package/src/components/chat/chat-components.tsx +3 -2
  23. package/src/components/chat/chat-panel.tsx +199 -74
  24. package/src/components/chat/chat-utils.ts +148 -34
  25. package/src/components/chat/user-message.tsx +15 -6
  26. package/src/components/data-table/charts/__tests__/altair-generator.test.ts +42 -27
  27. package/src/components/data-table/charts/chart-spec/altair-generator.ts +2 -6
  28. package/src/core/ai/__tests__/attachments.test.ts +153 -0
  29. package/src/core/ai/attachments.ts +80 -0
  30. package/src/utils/python-poet/poet.ts +12 -2
  31. package/dist/useDeepCompareMemoize-Bvrue1iy.js +0 -11
@@ -0,0 +1,568 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import {
4
+ act,
5
+ fireEvent,
6
+ render,
7
+ screen,
8
+ waitFor,
9
+ } from "@testing-library/react";
10
+ import { createStore, Provider } from "jotai";
11
+ import type { UIMessage } from "ai";
12
+ import type { ComponentProps } from "react";
13
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
14
+ import type { PromptInput } from "@/components/editor/ai/prompt-input";
15
+ import { resolveChatContext } from "@/components/editor/ai/completion-utils";
16
+ import { toast } from "@/components/ui/use-toast";
17
+ import { chatStateAtom, pendingAiPromptAtom } from "@/core/ai/state";
18
+ import { userConfigAtom } from "@/core/config/config";
19
+ import ChatPanel from "../chat-panel";
20
+ import * as notebookContext from "../notebook-context";
21
+
22
+ const notebookContextPart = {
23
+ type: "data-marimo-notebook",
24
+ data: expect.objectContaining({ sessionId: expect.any(String), cells: [] }),
25
+ };
26
+
27
+ const { sendMessage, messages } = vi.hoisted(() => ({
28
+ sendMessage: vi.fn(),
29
+ messages: new Array<UIMessage>(),
30
+ }));
31
+
32
+ vi.mock("@ai-sdk/react", () => ({
33
+ useChat: ({ id }: { id: string }) => ({
34
+ id,
35
+ messages,
36
+ sendMessage,
37
+ status: "ready",
38
+ stop: vi.fn(),
39
+ regenerate: vi.fn(),
40
+ addToolOutput: vi.fn(),
41
+ addToolApprovalResponse: vi.fn(),
42
+ }),
43
+ }));
44
+
45
+ vi.mock("@/core/config/config", async (importOriginal) => {
46
+ const { atom } = await import("jotai");
47
+ return {
48
+ ...(await importOriginal<typeof import("@/core/config/config")>()),
49
+ aiModelConfiguredAtom: atom(true),
50
+ };
51
+ });
52
+
53
+ vi.mock("@/core/ai/model-registry", () => ({
54
+ getKnownModelMaps: () => ({
55
+ modelMap: new Map([["openai/text-only", { input_types: ["text"] }]]),
56
+ }),
57
+ }));
58
+
59
+ vi.mock("@/core/ai/config", () => ({
60
+ useAIConfigActions: () => ({ saveModeChange: vi.fn() }),
61
+ }));
62
+ vi.mock("@/core/ai/staged-cells", () => ({
63
+ useStagedAICellsActions: () => ({ addStagedCell: vi.fn() }),
64
+ }));
65
+ vi.mock("@/core/cells/actions", () => ({
66
+ useCellActions: () => ({ createCell: vi.fn() }),
67
+ }));
68
+ vi.mock("@/core/network/requests", () => ({
69
+ useRequestClient: () => ({ invokeAiTool: vi.fn() }),
70
+ }));
71
+ vi.mock("@/core/runtime/config", () => ({
72
+ useRuntimeManager: () => ({
73
+ getAiURL: () => new URL("http://localhost/api/ai/chat"),
74
+ headers: () => ({}),
75
+ }),
76
+ }));
77
+ vi.mock("@/components/app-config/state", () => ({
78
+ useOpenSettingsToTab: () => ({ handleClick: vi.fn() }),
79
+ }));
80
+ vi.mock("@/components/editor/actions/pair-with-agent", () => ({
81
+ PairWithAgentBanner: () => null,
82
+ usePairWithAgentModal: () => vi.fn(),
83
+ }));
84
+ vi.mock("@/components/editor/chrome/wrapper/pending-ai-cells", () => ({
85
+ PendingAICells: () => null,
86
+ }));
87
+ vi.mock("@/components/ai/ai-model-dropdown", () => ({
88
+ AIModelDropdown: () => null,
89
+ }));
90
+ vi.mock("../chat-history-popover", () => ({ ChatHistoryPopover: () => null }));
91
+ vi.mock("../capabilities-popover", () => ({ CapabilitiesPopover: () => null }));
92
+ vi.mock("../notebook-access-selector", () => ({
93
+ NotebookAccessSelector: () => null,
94
+ }));
95
+ vi.mock("../chat-display", () => ({
96
+ renderUIMessage: () => null,
97
+ getAnswerText: () => "",
98
+ }));
99
+ vi.mock("@/components/mcp/mcp-status-indicator", () => ({
100
+ MCPStatusIndicator: () => null,
101
+ }));
102
+ vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
103
+
104
+ vi.mock("@/components/editor/ai/prompt-input", () => ({
105
+ PromptInput: ({
106
+ value,
107
+ onChange,
108
+ inputRef,
109
+ onSubmit,
110
+ }: ComponentProps<typeof PromptInput>) => (
111
+ <textarea
112
+ aria-label={inputRef ? "Prompt" : "Message"}
113
+ value={value}
114
+ onChange={(event) => onChange(event.target.value)}
115
+ onKeyDown={(event) => {
116
+ if (event.key === "Enter") {
117
+ onSubmit(undefined, value);
118
+ }
119
+ }}
120
+ />
121
+ ),
122
+ }));
123
+
124
+ vi.mock("@/components/editor/ai/completion-utils", async (importOriginal) => ({
125
+ ...(await importOriginal<
126
+ typeof import("@/components/editor/ai/completion-utils")
127
+ >()),
128
+ resolveChatContext: vi.fn(),
129
+ }));
130
+
131
+ function setup() {
132
+ const store = createStore();
133
+ store.set(userConfigAtom, (config) => ({
134
+ ...config,
135
+ ai: {
136
+ ...config.ai,
137
+ models: {
138
+ ...config.ai.models,
139
+ chat_model: "openai/text-only",
140
+ },
141
+ },
142
+ }));
143
+ store.set(chatStateAtom, { chats: new Map(), activeChatId: null });
144
+ render(
145
+ <Provider store={store}>
146
+ <ChatPanel />
147
+ </Provider>,
148
+ );
149
+ return store;
150
+ }
151
+
152
+ describe("pending chat prompts", () => {
153
+ beforeEach(() => {
154
+ vi.clearAllMocks();
155
+ messages.length = 0;
156
+ sendMessage.mockReset();
157
+ vi.stubGlobal("requestAnimationFrame", () => 0);
158
+ });
159
+ afterEach(() => {
160
+ vi.unstubAllGlobals();
161
+ vi.restoreAllMocks();
162
+ });
163
+
164
+ it.each(["new", "existing"])(
165
+ "waits for file normalization before submitting (%s chat)",
166
+ async (chat) => {
167
+ vi.mocked(resolveChatContext).mockResolvedValue({
168
+ contextPart: null,
169
+ attachments: [],
170
+ });
171
+ sendMessage.mockImplementation(
172
+ (message: { parts: UIMessage["parts"] }) => {
173
+ messages.push({
174
+ id: `sent-${messages.length}`,
175
+ role: "user",
176
+ parts: message.parts,
177
+ });
178
+ },
179
+ );
180
+ const store = setup();
181
+ if (chat === "existing") {
182
+ act(() =>
183
+ store.set(pendingAiPromptAtom, { prompt: "hello", submit: true }),
184
+ );
185
+ await screen.findByRole("button", { name: "Edit message" });
186
+ sendMessage.mockClear();
187
+ }
188
+ const file = new File(["hello"], "README");
189
+ const read = Promise.withResolvers<ArrayBuffer>();
190
+ vi.spyOn(file, "arrayBuffer").mockReturnValue(read.promise);
191
+ const fileInput =
192
+ document.querySelector<HTMLInputElement>('input[type="file"]');
193
+ if (!fileInput) {
194
+ throw new Error("Missing attachment input");
195
+ }
196
+ fireEvent.change(fileInput, { target: { files: [file] } });
197
+ const prompt = screen.getByRole("textbox", { name: "Prompt" });
198
+ fireEvent.change(prompt, { target: { value: "read my file" } });
199
+ expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled();
200
+ fireEvent.keyDown(prompt, { key: "Enter" });
201
+ await act(async () => {
202
+ await Promise.resolve();
203
+ });
204
+ expect(sendMessage).not.toHaveBeenCalled();
205
+ await act(async () => {
206
+ read.resolve(new TextEncoder().encode("hello").buffer);
207
+ await read.promise;
208
+ });
209
+ await screen.findByText("README");
210
+ fireEvent.click(screen.getByRole("button", { name: "Submit" }));
211
+ await waitFor(() =>
212
+ expect(sendMessage).toHaveBeenCalledExactlyOnceWith({
213
+ role: "user",
214
+ parts: [
215
+ notebookContextPart,
216
+ { type: "text", text: "read my file" },
217
+ {
218
+ type: "file",
219
+ filename: "README",
220
+ mediaType: "text/plain",
221
+ url: "data:text/plain;base64,aGVsbG8=",
222
+ },
223
+ ],
224
+ }),
225
+ );
226
+ },
227
+ );
228
+
229
+ it("keeps rejected edits open and allows retrying after switching models", async () => {
230
+ const contextualize = vi.spyOn(notebookContext, "withNotebookContext");
231
+ vi.mocked(resolveChatContext).mockResolvedValue({
232
+ contextPart: null,
233
+ attachments: [],
234
+ });
235
+ messages.push({
236
+ id: "image-message",
237
+ role: "user",
238
+ parts: [
239
+ { type: "text", text: "original text" },
240
+ {
241
+ type: "file",
242
+ filename: "chart.png",
243
+ mediaType: "image/png",
244
+ url: "data:image/png;base64,aW1hZ2U=",
245
+ },
246
+ ],
247
+ });
248
+ const store = setup();
249
+ fireEvent.click(screen.getByRole("button", { name: "Edit message" }));
250
+ const prompts = screen.getAllByRole("textbox", { name: "Prompt" });
251
+ const edit = prompts[0];
252
+ fireEvent.change(edit, { target: { value: "edited text" } });
253
+ fireEvent.click(screen.getByRole("button", { name: "Send" }));
254
+ await waitFor(() =>
255
+ expect(toast).toHaveBeenCalledWith(
256
+ expect.objectContaining({ title: "Unsupported attachment" }),
257
+ ),
258
+ );
259
+ expect(edit).toHaveValue("edited text");
260
+ expect(edit).toBeInTheDocument();
261
+ expect(sendMessage).not.toHaveBeenCalled();
262
+ act(() =>
263
+ store.set(userConfigAtom, (config) => ({
264
+ ...config,
265
+ ai: {
266
+ ...config.ai,
267
+ models: {
268
+ ...config.ai.models,
269
+ chat_model: "custom/vision",
270
+ },
271
+ },
272
+ })),
273
+ );
274
+ fireEvent.click(screen.getByRole("button", { name: "Send" }));
275
+ await waitFor(() =>
276
+ expect(sendMessage).toHaveBeenCalledExactlyOnceWith({
277
+ role: "user",
278
+ messageId: "image-message",
279
+ parts: [
280
+ notebookContextPart,
281
+ { type: "text", text: "edited text" },
282
+ {
283
+ type: "file",
284
+ filename: "chart.png",
285
+ mediaType: "image/png",
286
+ url: "data:image/png;base64,aW1hZ2U=",
287
+ },
288
+ ],
289
+ }),
290
+ );
291
+ await waitFor(() => expect(edit).not.toBeInTheDocument());
292
+ expect(contextualize).toHaveBeenLastCalledWith(
293
+ expect.any(Array),
294
+ [],
295
+ expect.any(Object),
296
+ );
297
+ });
298
+
299
+ it.each(["new", "existing"])(
300
+ "preserves the draft and attachments after a read failure (%s chat)",
301
+ async (chat) => {
302
+ vi.mocked(resolveChatContext).mockResolvedValue({
303
+ contextPart: null,
304
+ attachments: [],
305
+ });
306
+ sendMessage.mockImplementation(
307
+ (message: { parts: UIMessage["parts"] }) => {
308
+ messages.push({
309
+ id: `sent-${messages.length}`,
310
+ role: "user",
311
+ parts: message.parts,
312
+ });
313
+ },
314
+ );
315
+ const store = setup();
316
+ if (chat === "existing") {
317
+ act(() =>
318
+ store.set(pendingAiPromptAtom, { prompt: "hello", submit: true }),
319
+ );
320
+ await screen.findByRole("button", { name: "Edit message" });
321
+ sendMessage.mockClear();
322
+ }
323
+
324
+ const fileInput =
325
+ document.querySelector<HTMLInputElement>('input[type="file"]');
326
+ if (!fileInput) {
327
+ throw new Error("Missing attachment input");
328
+ }
329
+ fireEvent.change(fileInput, {
330
+ target: {
331
+ files: [new File(["hello"], "notes.txt", { type: "text/plain" })],
332
+ },
333
+ });
334
+ const attachmentPill = await screen.findByText("notes.txt");
335
+ fireEvent.change(screen.getByRole("textbox", { name: "Prompt" }), {
336
+ target: { value: "read my notes" },
337
+ });
338
+ const chatState = store.get(chatStateAtom);
339
+ const read = vi
340
+ .spyOn(FileReader.prototype, "readAsDataURL")
341
+ .mockImplementation(function (this: FileReader) {
342
+ this.dispatchEvent(new Event("error"));
343
+ });
344
+
345
+ fireEvent.click(screen.getByRole("button", { name: "Submit" }));
346
+
347
+ await waitFor(() =>
348
+ expect(toast).toHaveBeenCalledWith({
349
+ title: "Could not read attachments",
350
+ description: "Try selecting the files again.",
351
+ variant: "danger",
352
+ }),
353
+ );
354
+ expect(sendMessage).not.toHaveBeenCalled();
355
+ expect(store.get(chatStateAtom)).toEqual(chatState);
356
+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue(
357
+ "read my notes",
358
+ );
359
+ expect(attachmentPill).toBeInTheDocument();
360
+
361
+ read.mockRestore();
362
+ fireEvent.click(screen.getByRole("button", { name: "Submit" }));
363
+
364
+ await waitFor(() =>
365
+ expect(sendMessage).toHaveBeenCalledExactlyOnceWith({
366
+ role: "user",
367
+ parts: [
368
+ notebookContextPart,
369
+ { type: "text", text: "read my notes" },
370
+ {
371
+ type: "file",
372
+ filename: "notes.txt",
373
+ mediaType: "text/plain",
374
+ url: "data:text/plain;base64,aGVsbG8=",
375
+ },
376
+ ],
377
+ }),
378
+ );
379
+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue("");
380
+ expect(attachmentPill).not.toBeInTheDocument();
381
+ },
382
+ );
383
+
384
+ it("keeps a rejected pending prompt as a draft without creating an empty chat", async () => {
385
+ vi.mocked(resolveChatContext).mockResolvedValue({
386
+ contextPart: null,
387
+ attachments: [
388
+ {
389
+ type: "file",
390
+ mediaType: "image/png",
391
+ filename: "cell.png",
392
+ url: "data:image/png;base64,aW1hZ2U=",
393
+ },
394
+ ],
395
+ });
396
+ const store = setup();
397
+ fireEvent.change(screen.getByRole("textbox", { name: "Prompt" }), {
398
+ target: { value: "existing draft" },
399
+ });
400
+
401
+ act(() =>
402
+ store.set(pendingAiPromptAtom, {
403
+ prompt: "describe @cell",
404
+ submit: true,
405
+ }),
406
+ );
407
+
408
+ await waitFor(() =>
409
+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue(
410
+ "existing draft describe @cell",
411
+ ),
412
+ );
413
+ expect(store.get(chatStateAtom)).toEqual({
414
+ chats: new Map(),
415
+ activeChatId: null,
416
+ });
417
+ expect(store.get(pendingAiPromptAtom)).toBeNull();
418
+ expect(sendMessage).not.toHaveBeenCalled();
419
+ expect(toast).toHaveBeenCalledWith(
420
+ expect.objectContaining({ title: "Unsupported attachment" }),
421
+ );
422
+ });
423
+
424
+ it("creates a chat and sends a supported pending prompt", async () => {
425
+ vi.mocked(resolveChatContext).mockResolvedValue({
426
+ contextPart: null,
427
+ attachments: [],
428
+ });
429
+ const store = setup();
430
+
431
+ act(() =>
432
+ store.set(pendingAiPromptAtom, { prompt: "hello", submit: true }),
433
+ );
434
+
435
+ await waitFor(() =>
436
+ expect(sendMessage).toHaveBeenCalledExactlyOnceWith({
437
+ role: "user",
438
+ parts: [notebookContextPart, { type: "text", text: "hello" }],
439
+ }),
440
+ );
441
+ expect(store.get(chatStateAtom).activeChatId).toEqual(expect.any(String));
442
+ expect(
443
+ [...store.get(chatStateAtom).chats.values()].map((chat) => ({
444
+ id: chat.id,
445
+ title: chat.title,
446
+ })),
447
+ ).toEqual([{ id: store.get(chatStateAtom).activeChatId, title: "hello" }]);
448
+ });
449
+
450
+ it("queues prompts between requests while the assistant's tool is still running", async () => {
451
+ vi.mocked(resolveChatContext).mockResolvedValue({
452
+ contextPart: null,
453
+ attachments: [],
454
+ });
455
+ sendMessage.mockImplementationOnce(() => {
456
+ messages.push({
457
+ id: "assistant-1",
458
+ role: "assistant",
459
+ parts: [
460
+ {
461
+ type: "tool-execute_code",
462
+ toolCallId: "call-1",
463
+ state: "input-available",
464
+ input: { code: "print(1)" },
465
+ },
466
+ ],
467
+ });
468
+ });
469
+ const store = setup();
470
+ act(() =>
471
+ store.set(pendingAiPromptAtom, { prompt: "run my code", submit: true }),
472
+ );
473
+ await screen.findByRole("button", { name: "Stop" });
474
+
475
+ act(() =>
476
+ store.set(pendingAiPromptAtom, {
477
+ prompt: "then explain it",
478
+ submit: true,
479
+ }),
480
+ );
481
+
482
+ await screen.findByText("then explain it");
483
+ expect(sendMessage).toHaveBeenCalledExactlyOnceWith({
484
+ role: "user",
485
+ parts: [notebookContextPart, { type: "text", text: "run my code" }],
486
+ });
487
+ expect(
488
+ screen.queryByRole("button", { name: "Send" }),
489
+ ).not.toBeInTheDocument();
490
+ fireEvent.click(
491
+ screen.getByRole("button", { name: "Remove queued message" }),
492
+ );
493
+ expect(screen.queryByText("then explain it")).not.toBeInTheDocument();
494
+ expect(sendMessage).toHaveBeenCalledOnce();
495
+ });
496
+
497
+ it("carries over the latest draft typed while context is resolving", async () => {
498
+ const context =
499
+ Promise.withResolvers<Awaited<ReturnType<typeof resolveChatContext>>>();
500
+ vi.mocked(resolveChatContext).mockReturnValueOnce(context.promise);
501
+ sendMessage.mockImplementationOnce(
502
+ (message: { parts: UIMessage["parts"] }) => {
503
+ messages.push({
504
+ id: "sent-message",
505
+ role: "user",
506
+ parts: message.parts,
507
+ });
508
+ },
509
+ );
510
+ const store = setup();
511
+ act(() =>
512
+ store.set(pendingAiPromptAtom, { prompt: "hello", submit: true }),
513
+ );
514
+ await waitFor(() =>
515
+ expect(resolveChatContext).toHaveBeenCalledWith("hello"),
516
+ );
517
+
518
+ fireEvent.change(screen.getByRole("textbox", { name: "Prompt" }), {
519
+ target: { value: "typed while waiting" },
520
+ });
521
+ await act(async () => {
522
+ context.resolve({ contextPart: null, attachments: [] });
523
+ await context.promise;
524
+ });
525
+
526
+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue(
527
+ "typed while waiting",
528
+ );
529
+ expect(sendMessage).toHaveBeenCalledOnce();
530
+ });
531
+
532
+ it("does not start the chat twice when two pending prompts resolve", async () => {
533
+ const first =
534
+ Promise.withResolvers<Awaited<ReturnType<typeof resolveChatContext>>>();
535
+ const second =
536
+ Promise.withResolvers<Awaited<ReturnType<typeof resolveChatContext>>>();
537
+ vi.mocked(resolveChatContext)
538
+ .mockReturnValueOnce(first.promise)
539
+ .mockReturnValueOnce(second.promise);
540
+ const store = setup();
541
+ act(() =>
542
+ store.set(pendingAiPromptAtom, { prompt: "first", submit: true }),
543
+ );
544
+ await waitFor(() =>
545
+ expect(resolveChatContext).toHaveBeenCalledWith("first"),
546
+ );
547
+ act(() =>
548
+ store.set(pendingAiPromptAtom, { prompt: "second", submit: true }),
549
+ );
550
+ await waitFor(() =>
551
+ expect(resolveChatContext).toHaveBeenCalledWith("second"),
552
+ );
553
+
554
+ await act(async () => {
555
+ first.resolve({ contextPart: null, attachments: [] });
556
+ await first.promise;
557
+ });
558
+ await act(async () => {
559
+ second.resolve({ contextPart: null, attachments: [] });
560
+ await second.promise;
561
+ });
562
+
563
+ expect(sendMessage).toHaveBeenCalledTimes(2);
564
+ expect(
565
+ [...store.get(chatStateAtom).chats.values()].map((chat) => chat.title),
566
+ ).toEqual(["first"]);
567
+ });
568
+ });