@antelopejs/dms-assistant 0.2.7-next.444.g0da96b6 → 0.2.7

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 (102) hide show
  1. package/package.json +6 -2
  2. package/frontend-vue/builder/tests/database-build.test.ts +0 -232
  3. package/frontend-vue/builder/tests/database-connect.test.ts +0 -348
  4. package/frontend-vue/builder/tests/database-display.test.ts +0 -112
  5. package/frontend-vue/builder/tests/database.test.ts +0 -138
  6. package/frontend-vue/builder/tests/enabled.test.ts +0 -17
  7. package/frontend-vue/builder/tests/owner-ui.test.ts +0 -29
  8. package/frontend-vue/builder/tests/stubs/frontend-module.ts +0 -63
  9. package/frontend-vue/builder/vitest.config.ts +0 -21
  10. package/frontend-vue/tests/assistant-actions.test.ts +0 -109
  11. package/frontend-vue/tests/assistant-activity.test.ts +0 -281
  12. package/frontend-vue/tests/backend-boundary.test.ts +0 -130
  13. package/frontend-vue/tests/backoff.test.ts +0 -40
  14. package/frontend-vue/tests/block-health.test.ts +0 -142
  15. package/frontend-vue/tests/channel-client.test.ts +0 -246
  16. package/frontend-vue/tests/chat/block-preview.test.ts +0 -367
  17. package/frontend-vue/tests/chat/block-target.test.ts +0 -133
  18. package/frontend-vue/tests/chat/build-view.test.ts +0 -171
  19. package/frontend-vue/tests/chat/chat-scroll.test.ts +0 -251
  20. package/frontend-vue/tests/chat/conversation-events.test.ts +0 -622
  21. package/frontend-vue/tests/chat/diff-and-keys.test.ts +0 -178
  22. package/frontend-vue/tests/chat/held-card.test.ts +0 -133
  23. package/frontend-vue/tests/chat/markdown-content.test.ts +0 -86
  24. package/frontend-vue/tests/chat/markdown.test.ts +0 -352
  25. package/frontend-vue/tests/chat/provider-notice.test.ts +0 -33
  26. package/frontend-vue/tests/chat/tool-lexicon.test.ts +0 -212
  27. package/frontend-vue/tests/chat/useChatChannel.test.ts +0 -124
  28. package/frontend-vue/tests/chat/useConversation.test.ts +0 -288
  29. package/frontend-vue/tests/chat-panel.test.ts +0 -300
  30. package/frontend-vue/tests/chat-transport.test.ts +0 -94
  31. package/frontend-vue/tests/embedding.test.ts +0 -10
  32. package/frontend-vue/tests/formal/connection-analysis-scenarios.ts +0 -130
  33. package/frontend-vue/tests/formal/connection-analysis-world.ts +0 -497
  34. package/frontend-vue/tests/formal/connection-analysis.test.ts +0 -36
  35. package/frontend-vue/tests/host-commands.test.ts +0 -182
  36. package/frontend-vue/tests/launcher-icon.test.ts +0 -62
  37. package/frontend-vue/tests/launcher-label.test.ts +0 -40
  38. package/frontend-vue/tests/launcher-state.test.ts +0 -215
  39. package/frontend-vue/tests/mockup-fold.test.ts +0 -95
  40. package/frontend-vue/tests/navigation.test.ts +0 -142
  41. package/frontend-vue/tests/onboarding-api.test.ts +0 -29
  42. package/frontend-vue/tests/onboarding-claude.test.ts +0 -144
  43. package/frontend-vue/tests/onboarding-connect-memory.test.ts +0 -126
  44. package/frontend-vue/tests/onboarding-controller-restart.test.ts +0 -134
  45. package/frontend-vue/tests/onboarding-controller.test.ts +0 -307
  46. package/frontend-vue/tests/onboarding-database-driver-install.test.ts +0 -112
  47. package/frontend-vue/tests/onboarding-database-engines.test.ts +0 -142
  48. package/frontend-vue/tests/onboarding-database-new-url.test.ts +0 -174
  49. package/frontend-vue/tests/onboarding-database-reload.test.ts +0 -229
  50. package/frontend-vue/tests/onboarding-database-tabs.test.ts +0 -184
  51. package/frontend-vue/tests/onboarding-database.test.ts +0 -540
  52. package/frontend-vue/tests/onboarding-deep-link.test.ts +0 -51
  53. package/frontend-vue/tests/onboarding-flow.test.ts +0 -204
  54. package/frontend-vue/tests/onboarding-install.test.ts +0 -62
  55. package/frontend-vue/tests/onboarding-mockups.test.ts +0 -86
  56. package/frontend-vue/tests/onboarding-scratch.test.ts +0 -70
  57. package/frontend-vue/tests/onboarding-widget.test.ts +0 -97
  58. package/frontend-vue/tests/palette-assistant.test.ts +0 -241
  59. package/frontend-vue/tests/panel-approvals.test.ts +0 -226
  60. package/frontend-vue/tests/panel-closed-conversation.test.ts +0 -53
  61. package/frontend-vue/tests/panel-mockup-prompt.test.ts +0 -238
  62. package/frontend-vue/tests/panel-modes.test.ts +0 -131
  63. package/frontend-vue/tests/panel-questions.test.ts +0 -151
  64. package/frontend-vue/tests/panel-states.test.ts +0 -252
  65. package/frontend-vue/tests/panel-tools.test.ts +0 -219
  66. package/frontend-vue/tests/session-gate.test.ts +0 -66
  67. package/frontend-vue/tests/sidecar-guest.test.ts +0 -81
  68. package/frontend-vue/tests/sidecar-status.test.ts +0 -117
  69. package/frontend-vue/tests/support/api-error-presenter.ts +0 -30
  70. package/frontend-vue/tests/support/database-connect.ts +0 -129
  71. package/frontend-vue/tests/support/dms-frontend-module.ts +0 -9
  72. package/frontend-vue/tests/support/dms-state.ts +0 -12
  73. package/frontend-vue/tests/support/fake-layout.ts +0 -119
  74. package/frontend-vue/tests/support/i18n.ts +0 -49
  75. package/frontend-vue/tests/support/onboarding-host.ts +0 -104
  76. package/frontend-vue/tests/support/onboarding.ts +0 -176
  77. package/frontend-vue/tests/support/panel-fixtures.ts +0 -155
  78. package/frontend-vue/tests/support/panel-harness.ts +0 -211
  79. package/frontend-vue/tests/support/setup-layout.ts +0 -3
  80. package/frontend-vue/tests/support/stand-ins/DmsBlockPreview.ts +0 -18
  81. package/frontend-vue/tests/support/stand-ins/DmsEmptyState.ts +0 -17
  82. package/frontend-vue/tests/support/stand-ins/DmsSegmentedControl.ts +0 -35
  83. package/frontend-vue/tests/support/stand-ins/DmsStatusPill.ts +0 -7
  84. package/frontend-vue/tests/support/stand-ins/OnboardingModal.ts +0 -13
  85. package/frontend-vue/tests/support/stand-ins/UBadge.ts +0 -7
  86. package/frontend-vue/tests/support/stand-ins/UButton.ts +0 -27
  87. package/frontend-vue/tests/support/stand-ins/UCheckbox.ts +0 -25
  88. package/frontend-vue/tests/support/stand-ins/UDropdownMenu.ts +0 -34
  89. package/frontend-vue/tests/support/stand-ins/UFormField.ts +0 -9
  90. package/frontend-vue/tests/support/stand-ins/UInput.ts +0 -16
  91. package/frontend-vue/tests/support/stand-ins/UKbd.ts +0 -7
  92. package/frontend-vue/tests/support/stand-ins/UModal.ts +0 -20
  93. package/frontend-vue/tests/support/stand-ins/UPopover.ts +0 -9
  94. package/frontend-vue/tests/support/stand-ins/UTabs.ts +0 -31
  95. package/frontend-vue/tests/support/stand-ins/UTextarea.ts +0 -19
  96. package/frontend-vue/tests/support/stubs.ts +0 -28
  97. package/frontend-vue/tests/views/api-data-reads.test.ts +0 -451
  98. package/frontend-vue/tests/views/api-error-presentation.test.ts +0 -89
  99. package/frontend-vue/tests/views/diff-view.test.ts +0 -167
  100. package/frontend-vue/tests/views/use-assistant.test.ts +0 -53
  101. package/frontend-vue/tests/views/view-format.test.ts +0 -59
  102. package/frontend-vue/vitest.config.ts +0 -33
@@ -1,300 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { flushPromises, mount } from "@vue/test-utils";
3
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4
- import { nextTick } from "vue";
5
- import ChatPanel from "../app/components/ChatPanel.vue";
6
- import {
7
- CONVERSATION_ID,
8
- createHarness,
9
- deliver,
10
- openPanel,
11
- sendMessage,
12
- sentOfType,
13
- unmountPanel,
14
- providedSession,
15
- } from "./support/panel-harness";
16
- import { PANEL_STUBS } from "./support/stubs";
17
-
18
- const STALL_AFTER_MS = 20_000;
19
-
20
- beforeEach(() => {
21
- localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
22
- });
23
-
24
- afterEach(() => {
25
- unmountPanel();
26
- localStorage.clear();
27
- vi.useRealTimers();
28
- });
29
-
30
- describe("the chat as a component of the dashboard", () => {
31
- it("renders in the dashboard document itself: no iframe, no second document", async () => {
32
- const harness = createHarness();
33
- const panel = await openPanel(harness);
34
- expect(document.querySelector("iframe")).toBeNull();
35
- expect(
36
- panel.find("[data-dms-side-panel] .dms-assistant-panel").exists(),
37
- ).toBe(true);
38
- expect(panel.find(".chat-view").exists()).toBe(true);
39
- expect(Reflect.has(globalThis, "dmsAssistantChatTransport")).toBe(false);
40
- });
41
-
42
- it("says hello with its conversation on the shared stream when it opens", async () => {
43
- const harness = createHarness();
44
- await openPanel(harness);
45
- expect(sentOfType(harness, "hello")).toEqual([
46
- { type: "hello", role: "chat", conversationId: CONVERSATION_ID },
47
- ]);
48
- });
49
-
50
- it("picks its conversation up again when the panel reopens, without announcing that it left", async () => {
51
- const harness = createHarness();
52
- const panel = await openPanel(harness);
53
- await sendMessage(panel, "build me a page");
54
- harness.session.panel.close();
55
- await nextTick();
56
- expect(panel.find(".chat-view").exists()).toBe(false);
57
- expect(sentOfType(harness, "leave_conversation")).toEqual([]);
58
- harness.session.panel.toggle();
59
- await flushPromises();
60
- expect(sentOfType(harness, "hello")).toEqual([
61
- { type: "hello", role: "chat", conversationId: CONVERSATION_ID },
62
- { type: "hello", role: "chat", conversationId: CONVERSATION_ID },
63
- ]);
64
- deliver(harness, {
65
- type: "conversation_snapshot",
66
- messages: [{ role: "user", content: "build me a page", timestampMs: 1 }],
67
- });
68
- await nextTick();
69
- expect(panel.text()).toContain("build me a page");
70
- });
71
-
72
- it("opens the settings page through the dashboard router, not the sidecar", async () => {
73
- const harness = createHarness();
74
- const panel = await openPanel(harness);
75
- const settings = panel
76
- .findAll(".u-dropdown-item")
77
- .find((item) => item.text() === "Settings");
78
- await settings?.trigger("click");
79
- expect(harness.navigate).toHaveBeenCalledExactlyOnceWith(
80
- "/modules/ai/settings",
81
- );
82
- expect(sentOfType(harness, "request_host_navigate")).toEqual([]);
83
- });
84
-
85
- it("asks for the conversation list again once a stream that was down connects", async () => {
86
- const harness = createHarness();
87
- harness.setChannelStatus("connecting");
88
- await openPanel(harness);
89
- expect(sentOfType(harness, "list_conversations")).toEqual([]);
90
- harness.setChannelStatus("connected");
91
- await nextTick();
92
- expect(sentOfType(harness, "list_conversations")).toHaveLength(1);
93
- });
94
-
95
- it("closes from its own button, and stays open on a click elsewhere: docked, it is part of the page", async () => {
96
- const harness = createHarness();
97
- const panel = await openPanel(harness);
98
- document.body.dispatchEvent(
99
- new PointerEvent("pointerdown", { bubbles: true, composed: true }),
100
- );
101
- expect(harness.session.panel.isOpen.value).toBe(true);
102
- await panel.find('button[aria-label="Close"]').trigger("click");
103
- expect(harness.session.panel.isOpen.value).toBe(false);
104
- });
105
-
106
- it("shows the first connection while the session is not there yet", async () => {
107
- const panel = mount(ChatPanel, {
108
- global: { provide: providedSession(null), stubs: PANEL_STUBS },
109
- });
110
- await nextTick();
111
- expect(panel.find(".dms-assistant-panel-status").text()).toContain(
112
- "Connecting the assistant",
113
- );
114
- expect(panel.find(".chat-view").exists()).toBe(false);
115
- panel.unmount();
116
- });
117
-
118
- it("keeps the transcript under a banner while the sidecar revives, and offers a restart once it gave up", async () => {
119
- const harness = createHarness();
120
- harness.lastError.value = "EADDRINUSE: port 5010 is already in use";
121
- const panel = await openPanel(harness);
122
- harness.sidecarStatus.value = "reviving";
123
- await nextTick();
124
- expect(panel.find(".dms-assistant-panel-status").exists()).toBe(false);
125
- expect(panel.find(".connection-banner").text()).toContain("restarting");
126
- harness.sidecarStatus.value = "unavailable";
127
- await nextTick();
128
- const screen = panel.find(".dms-assistant-panel-status");
129
- expect(screen.text()).toContain("The assistant isn't running");
130
- expect(screen.text()).toContain("EADDRINUSE");
131
- const restart = screen
132
- .findAll("button")
133
- .find((button) => button.text() === "Restart assistant");
134
- await restart?.trigger("click");
135
- expect(harness.restart).toHaveBeenCalledOnce();
136
- await screen.find('button[aria-label="Close"]').trigger("click");
137
- expect(harness.session.panel.isOpen.value).toBe(false);
138
- harness.sidecarStatus.value = "connected";
139
- await nextTick();
140
- expect(panel.find(".dms-assistant-panel-status").exists()).toBe(false);
141
- });
142
-
143
- it("renders the answer as markup, with nothing the model wrote running in the dashboard", async () => {
144
- vi.useFakeTimers();
145
- const harness = createHarness();
146
- const panel = await openPanel(harness);
147
- await sendMessage(panel, "go");
148
- deliver(harness, {
149
- type: "assistant_message_chunk",
150
- text: '**Done** <img src=x onerror="window.pwned=1"> [x](javascript:alert(1))',
151
- });
152
- await vi.advanceTimersByTimeAsync(100);
153
- deliver(harness, { type: "run_done" });
154
- await nextTick();
155
- const answer = panel.find(".chat-markdown");
156
- expect(answer.find("strong").text()).toBe("Done");
157
- expect(answer.find("img").exists()).toBe(false);
158
- expect(answer.find("a").exists()).toBe(false);
159
- expect(Reflect.get(globalThis, "pwned")).toBeUndefined();
160
- });
161
- });
162
-
163
- describe("a running turn shows what it is doing, and never spins forever", () => {
164
- it("shows the activity the sidecar reports, with the elapsed time", async () => {
165
- const harness = createHarness();
166
- const panel = await openPanel(harness);
167
- await sendMessage(panel, "reproduce this page");
168
- deliver(harness, {
169
- type: "run_progress",
170
- activity: "writing",
171
- detail: "Write",
172
- elapsedMs: 72_000,
173
- idleMs: 0,
174
- });
175
- await nextTick();
176
- expect(panel.find(".thinking").text()).toContain("Preparing · Write file…");
177
- expect(panel.find(".thinking-clock").text()).toBe("1:12");
178
- });
179
-
180
- it("says so after 20 s without news about the turn, and reconnects or stops from there", async () => {
181
- vi.useFakeTimers();
182
- const harness = createHarness();
183
- const panel = await openPanel(harness);
184
- await sendMessage(panel, "reproduce this page");
185
- await vi.advanceTimersByTimeAsync(STALL_AFTER_MS + 1_000);
186
- const notice = panel.find(".run-stalled");
187
- expect(notice.text()).toContain("No news from the assistant for 0:2");
188
- const [reconnect, stop] = notice.findAll("button");
189
- await reconnect?.trigger("click");
190
- expect(harness.reconnects).toBe(1);
191
- await stop?.trigger("click");
192
- expect(sentOfType(harness, "interrupt_turn")).toHaveLength(1);
193
- });
194
-
195
- it("stays quiet while the sidecar keeps reporting a long step", async () => {
196
- vi.useFakeTimers();
197
- const harness = createHarness();
198
- const panel = await openPanel(harness);
199
- await sendMessage(panel, "reproduce this page");
200
- for (let beat = 0; beat < 8; beat += 1) {
201
- await vi.advanceTimersByTimeAsync(5_000);
202
- deliver(harness, {
203
- type: "run_progress",
204
- activity: "tool",
205
- detail: "Write",
206
- elapsedMs: (beat + 1) * 5_000,
207
- idleMs: 0,
208
- });
209
- }
210
- await nextTick();
211
- expect(panel.find(".run-stalled").exists()).toBe(false);
212
- expect(panel.find(".thinking").exists()).toBe(true);
213
- });
214
-
215
- it("shows a run error with Retry turn, which asks the sidecar to run it again", async () => {
216
- const harness = createHarness();
217
- const panel = await openPanel(harness);
218
- await sendMessage(panel, "reproduce this page");
219
- deliver(harness, { type: "run_error", error: "API Error: 529 overloaded" });
220
- await nextTick();
221
- const error = panel.find(".message-bubble-error");
222
- expect(error.text()).toContain("API Error: 529 overloaded");
223
- const retry = error
224
- .findAll("button")
225
- .find((button) => button.text() === "Retry turn");
226
- await retry?.trigger("click");
227
- expect(sentOfType(harness, "retry_turn")).toHaveLength(1);
228
- });
229
-
230
- it("offers no Retry for a run error that sending again cannot fix", async () => {
231
- const harness = createHarness();
232
- const panel = await openPanel(harness);
233
- await sendMessage(panel, "reproduce this page");
234
- deliver(harness, {
235
- type: "run_error",
236
- error: "Prompt is too long",
237
- isRetryable: false,
238
- });
239
- await nextTick();
240
- const error = panel.find(".message-bubble-error");
241
- expect(error.text()).toContain("Prompt is too long");
242
- expect(error.text()).not.toContain("Retry turn");
243
- });
244
-
245
- it("says a message was not sent when the stream dropped as it left", async () => {
246
- const harness = createHarness();
247
- const panel = await openPanel(harness);
248
- await panel.find("textarea").setValue("reproduce this page");
249
- harness.setChannelStatus("reconnecting");
250
- await panel.find("form.composer").trigger("submit");
251
- expect(panel.find(".message-bubble-error").text()).toContain(
252
- "Your message was not sent",
253
- );
254
- expect(sentOfType(harness, "user_message")).toEqual([]);
255
- });
256
-
257
- it("shows the error a run left in the stored transcript after a reload", async () => {
258
- const harness = createHarness();
259
- const panel = await openPanel(harness);
260
- deliver(harness, {
261
- type: "conversation_snapshot",
262
- messages: [
263
- { role: "user", content: "go", timestampMs: 1 },
264
- { role: "error", content: "The run was stopped.", timestampMs: 2 },
265
- ],
266
- });
267
- await nextTick();
268
- expect(panel.find(".message-bubble-error").text()).toContain(
269
- "The run was stopped.",
270
- );
271
- });
272
- });
273
-
274
- describe("the shared stream going away and coming back", () => {
275
- it("says reconnecting and holds the input, then says hello again and picks the transcript up, as after a dms-assistant hot reload", async () => {
276
- const harness = createHarness();
277
- const panel = await openPanel(harness);
278
- harness.setChannelStatus("reconnecting");
279
- await nextTick();
280
- expect(panel.find(".connection-banner").text()).toContain(
281
- "Connection lost",
282
- );
283
- expect(panel.find("textarea").attributes("disabled")).toBeDefined();
284
- harness.setChannelStatus("connected");
285
- harness.hub.announceReady();
286
- deliver(harness, {
287
- type: "conversation_snapshot",
288
- messages: [
289
- { role: "user", content: "before the reload", timestampMs: 1 },
290
- ],
291
- });
292
- deliver(harness, { type: "run_resumed" });
293
- await nextTick();
294
- expect(sentOfType(harness, "hello")).toHaveLength(2);
295
- expect(panel.find(".connection-banner").exists()).toBe(false);
296
- expect(panel.find("textarea").attributes("disabled")).toBeUndefined();
297
- expect(panel.text()).toContain("before the reload");
298
- expect(panel.find(".thinking").exists()).toBe(true);
299
- });
300
- });
@@ -1,94 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import { createChatTransport } from "../app/runtime/chat-transport";
3
- import { createFrameRouter } from "../app/runtime/frame-router";
4
-
5
- function hub() {
6
- const actions = {
7
- send: vi.fn(() => true),
8
- reconnect: vi.fn(),
9
- getStatus: vi.fn(() => "connected" as const),
10
- };
11
- return { actions, chat: createChatTransport(actions) };
12
- }
13
-
14
- describe("chat transport", () => {
15
- it("gives the chat its messages, readiness and status, and sends through the stream", () => {
16
- const { actions, chat } = hub();
17
- const messages: object[] = [];
18
- const statuses: string[] = [];
19
- const ready = vi.fn();
20
- chat.transport.onMessage((msg) => messages.push(msg));
21
- chat.transport.onStatus((status) => statuses.push(status));
22
- chat.transport.onReady(ready);
23
- chat.deliver({ type: "run_done" });
24
- chat.announceStatus("reconnecting");
25
- chat.announceReady();
26
- expect(chat.transport.send({ type: "hello" })).toBe(true);
27
- chat.transport.reconnect();
28
- expect(messages).toEqual([{ type: "run_done" }]);
29
- expect(statuses).toEqual(["reconnecting"]);
30
- expect(ready).toHaveBeenCalledTimes(1);
31
- expect(actions.send).toHaveBeenCalledWith({ type: "hello" });
32
- expect(actions.reconnect).toHaveBeenCalledTimes(1);
33
- expect(chat.transport.getStatus()).toBe("connected");
34
- });
35
-
36
- it("stops delivering to a listener once it unsubscribed", () => {
37
- const { chat } = hub();
38
- const messages: object[] = [];
39
- const unsubscribe = chat.transport.onMessage((msg) => messages.push(msg));
40
- unsubscribe();
41
- chat.deliver({});
42
- expect(messages).toEqual([]);
43
- });
44
-
45
- it("keeps delivering when one listener throws", () => {
46
- const { chat } = hub();
47
- const messages: object[] = [];
48
- const error = vi
49
- .spyOn(console, "error")
50
- .mockImplementation(() => undefined);
51
- chat.transport.onMessage(() => {
52
- throw new Error("broken listener");
53
- });
54
- chat.transport.onMessage((msg) => messages.push(msg));
55
- chat.deliver({ type: "run_done" });
56
- expect(messages).toEqual([{ type: "run_done" }]);
57
- error.mockRestore();
58
- });
59
-
60
- it("publishes nothing on the window: no other document borrows it any more", () => {
61
- hub();
62
- expect(Reflect.has(globalThis, "dmsAssistantChatTransport")).toBe(false);
63
- });
64
- });
65
-
66
- describe("frame routing on the tab's one stream", () => {
67
- it("hands host commands to the dashboard and everything else to the chat, parsed once", () => {
68
- const host = vi.fn();
69
- const chat = vi.fn();
70
- const route = createFrameRouter({ host, chat });
71
- route('{"type":"host_command_navigate","path":"/x"}');
72
- route(
73
- '{"type":"assistant_message_chunk","conversationId":"c","text":"hi"}',
74
- );
75
- route('{"type":"settings_update","settings":{}}');
76
- expect(host.mock.calls).toEqual([
77
- [{ type: "host_command_navigate", path: "/x" }],
78
- ]);
79
- expect(chat.mock.calls.map(([msg]) => msg.type)).toEqual([
80
- "assistant_message_chunk",
81
- "settings_update",
82
- ]);
83
- });
84
-
85
- it("drops what is not a typed message", () => {
86
- const host = vi.fn();
87
- const chat = vi.fn();
88
- const route = createFrameRouter({ host, chat });
89
- for (const raw of ["not json", "42", "null", '{"type":7}', "[]"])
90
- route(raw);
91
- expect(host).not.toHaveBeenCalled();
92
- expect(chat).not.toHaveBeenCalled();
93
- });
94
- });
@@ -1,10 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { isEmbedded } from "../app/runtime/embedding";
3
-
4
- describe("a dashboard drawn in a frame", () => {
5
- it("is embedded when its window is not the top one (fails when a framed mockup starts its own assistant)", () => {
6
- const top = { name: "top" };
7
- expect(isEmbedded({ self: { name: "frame" }, top })).toBe(true);
8
- expect(isEmbedded({ self: top, top })).toBe(false);
9
- });
10
- });
@@ -1,130 +0,0 @@
1
- import type { JobKind, Scenario, Step } from "./connection-analysis-world";
2
-
3
- const OPEN: Step = { kind: "open" };
4
- const CLOSE: Step = { kind: "close" };
5
- const RESET: Step = { kind: "reset" };
6
- const CLOSE_TAB: Step = { kind: "closeTab" };
7
- const CLOSE_TAB_QUIET: Step = { kind: "closeTab", quiet: true };
8
- const RESET_QUIET: Step = { kind: "reset", quiet: true };
9
-
10
- const connect = (database: string, quiet = false): Step => ({
11
- kind: "connect",
12
- database,
13
- quiet,
14
- });
15
-
16
- const STARTS_TWICE = "2 analysis jobs started for shop, where one may";
17
-
18
- /**
19
- * Two tabs that both remember `shop`, as a tab duplicated while a connection loads does: the
20
- * project declares it and each tab's storage holds it.
21
- */
22
- function duplicated(
23
- name: string,
24
- job: JobKind,
25
- first: Step[],
26
- second: Step[],
27
- defect?: string,
28
- ): Scenario {
29
- return {
30
- name,
31
- job,
32
- declared: ["shop"],
33
- remembered: ["shop", "shop"],
34
- programs: [first, second],
35
- ...(defect === undefined ? {} : { defect }),
36
- };
37
- }
38
-
39
- /** A tab with nothing remembered, which connects by hand. */
40
- function connecting(
41
- name: string,
42
- job: JobKind,
43
- first: Step[],
44
- second: Step[] = [],
45
- ): Scenario {
46
- return {
47
- name,
48
- job,
49
- declared: [],
50
- remembered: [null, null],
51
- programs: [first, second],
52
- };
53
- }
54
-
55
- /**
56
- * The tabs, popups and orders of steps the check covers: two tabs of one browser, each with one
57
- * program of steps, and a job that does or does not ask which schemas to read.
58
- */
59
- export const SCENARIOS: Scenario[] = [
60
- duplicated("duplicate, both stay", "asks-schemas", [OPEN], [OPEN]),
61
- duplicated("duplicate, both stay, no question", "direct", [OPEN], [OPEN]),
62
- duplicated(
63
- "duplicate, the first tab closes once every answer arrived",
64
- "asks-schemas",
65
- [OPEN, CLOSE_TAB_QUIET],
66
- [OPEN],
67
- ),
68
- duplicated(
69
- "duplicate, the second tab closes once every answer arrived",
70
- "direct",
71
- [OPEN],
72
- [OPEN, CLOSE_TAB_QUIET],
73
- ),
74
- duplicated(
75
- "duplicate, the first tab resets once every answer arrived",
76
- "asks-schemas",
77
- [OPEN, RESET_QUIET],
78
- [OPEN],
79
- ),
80
- duplicated(
81
- "duplicate, the first tab closes while an answer is in flight",
82
- "direct",
83
- [OPEN, CLOSE_TAB],
84
- [OPEN],
85
- STARTS_TWICE,
86
- ),
87
- duplicated(
88
- "duplicate, the first tab resets while an answer is in flight",
89
- "direct",
90
- [OPEN, RESET],
91
- [OPEN],
92
- STARTS_TWICE,
93
- ),
94
- duplicated(
95
- "duplicate, the first tab connects another database once every answer arrived",
96
- "asks-schemas",
97
- [OPEN, connect("orders", true)],
98
- [OPEN],
99
- ),
100
- duplicated(
101
- "duplicate, the first tab connects another database while an answer is in flight",
102
- "direct",
103
- [OPEN, connect("orders")],
104
- [OPEN],
105
- STARTS_TWICE,
106
- ),
107
- connecting(
108
- "connect, close the popup, open it, connect another",
109
- "asks-schemas",
110
- [OPEN, connect("shop"), CLOSE, OPEN, connect("orders")],
111
- ),
112
- connecting("connect, close the popup, open it, reset", "direct", [
113
- OPEN,
114
- connect("shop"),
115
- CLOSE,
116
- OPEN,
117
- RESET,
118
- ]),
119
- connecting("connect, reset, connect another", "asks-schemas", [
120
- OPEN,
121
- connect("shop"),
122
- RESET,
123
- connect("orders"),
124
- ]),
125
- connecting("connect twice", "direct", [
126
- OPEN,
127
- connect("shop"),
128
- connect("shop"),
129
- ]),
130
- ];