@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.
- package/package.json +6 -2
- package/frontend-vue/builder/tests/database-build.test.ts +0 -232
- package/frontend-vue/builder/tests/database-connect.test.ts +0 -348
- package/frontend-vue/builder/tests/database-display.test.ts +0 -112
- package/frontend-vue/builder/tests/database.test.ts +0 -138
- package/frontend-vue/builder/tests/enabled.test.ts +0 -17
- package/frontend-vue/builder/tests/owner-ui.test.ts +0 -29
- package/frontend-vue/builder/tests/stubs/frontend-module.ts +0 -63
- package/frontend-vue/builder/vitest.config.ts +0 -21
- package/frontend-vue/tests/assistant-actions.test.ts +0 -109
- package/frontend-vue/tests/assistant-activity.test.ts +0 -281
- package/frontend-vue/tests/backend-boundary.test.ts +0 -130
- package/frontend-vue/tests/backoff.test.ts +0 -40
- package/frontend-vue/tests/block-health.test.ts +0 -142
- package/frontend-vue/tests/channel-client.test.ts +0 -246
- package/frontend-vue/tests/chat/block-preview.test.ts +0 -367
- package/frontend-vue/tests/chat/block-target.test.ts +0 -133
- package/frontend-vue/tests/chat/build-view.test.ts +0 -171
- package/frontend-vue/tests/chat/chat-scroll.test.ts +0 -251
- package/frontend-vue/tests/chat/conversation-events.test.ts +0 -622
- package/frontend-vue/tests/chat/diff-and-keys.test.ts +0 -178
- package/frontend-vue/tests/chat/held-card.test.ts +0 -133
- package/frontend-vue/tests/chat/markdown-content.test.ts +0 -86
- package/frontend-vue/tests/chat/markdown.test.ts +0 -352
- package/frontend-vue/tests/chat/provider-notice.test.ts +0 -33
- package/frontend-vue/tests/chat/tool-lexicon.test.ts +0 -212
- package/frontend-vue/tests/chat/useChatChannel.test.ts +0 -124
- package/frontend-vue/tests/chat/useConversation.test.ts +0 -288
- package/frontend-vue/tests/chat-panel.test.ts +0 -300
- package/frontend-vue/tests/chat-transport.test.ts +0 -94
- package/frontend-vue/tests/embedding.test.ts +0 -10
- package/frontend-vue/tests/formal/connection-analysis-scenarios.ts +0 -130
- package/frontend-vue/tests/formal/connection-analysis-world.ts +0 -497
- package/frontend-vue/tests/formal/connection-analysis.test.ts +0 -36
- package/frontend-vue/tests/host-commands.test.ts +0 -182
- package/frontend-vue/tests/launcher-icon.test.ts +0 -62
- package/frontend-vue/tests/launcher-label.test.ts +0 -40
- package/frontend-vue/tests/launcher-state.test.ts +0 -215
- package/frontend-vue/tests/mockup-fold.test.ts +0 -95
- package/frontend-vue/tests/navigation.test.ts +0 -142
- package/frontend-vue/tests/onboarding-api.test.ts +0 -29
- package/frontend-vue/tests/onboarding-claude.test.ts +0 -144
- package/frontend-vue/tests/onboarding-connect-memory.test.ts +0 -126
- package/frontend-vue/tests/onboarding-controller-restart.test.ts +0 -134
- package/frontend-vue/tests/onboarding-controller.test.ts +0 -307
- package/frontend-vue/tests/onboarding-database-driver-install.test.ts +0 -112
- package/frontend-vue/tests/onboarding-database-engines.test.ts +0 -142
- package/frontend-vue/tests/onboarding-database-new-url.test.ts +0 -174
- package/frontend-vue/tests/onboarding-database-reload.test.ts +0 -229
- package/frontend-vue/tests/onboarding-database-tabs.test.ts +0 -184
- package/frontend-vue/tests/onboarding-database.test.ts +0 -540
- package/frontend-vue/tests/onboarding-deep-link.test.ts +0 -51
- package/frontend-vue/tests/onboarding-flow.test.ts +0 -204
- package/frontend-vue/tests/onboarding-install.test.ts +0 -62
- package/frontend-vue/tests/onboarding-mockups.test.ts +0 -86
- package/frontend-vue/tests/onboarding-scratch.test.ts +0 -70
- package/frontend-vue/tests/onboarding-widget.test.ts +0 -97
- package/frontend-vue/tests/palette-assistant.test.ts +0 -241
- package/frontend-vue/tests/panel-approvals.test.ts +0 -226
- package/frontend-vue/tests/panel-closed-conversation.test.ts +0 -53
- package/frontend-vue/tests/panel-mockup-prompt.test.ts +0 -238
- package/frontend-vue/tests/panel-modes.test.ts +0 -131
- package/frontend-vue/tests/panel-questions.test.ts +0 -151
- package/frontend-vue/tests/panel-states.test.ts +0 -252
- package/frontend-vue/tests/panel-tools.test.ts +0 -219
- package/frontend-vue/tests/session-gate.test.ts +0 -66
- package/frontend-vue/tests/sidecar-guest.test.ts +0 -81
- package/frontend-vue/tests/sidecar-status.test.ts +0 -117
- package/frontend-vue/tests/support/api-error-presenter.ts +0 -30
- package/frontend-vue/tests/support/database-connect.ts +0 -129
- package/frontend-vue/tests/support/dms-frontend-module.ts +0 -9
- package/frontend-vue/tests/support/dms-state.ts +0 -12
- package/frontend-vue/tests/support/fake-layout.ts +0 -119
- package/frontend-vue/tests/support/i18n.ts +0 -49
- package/frontend-vue/tests/support/onboarding-host.ts +0 -104
- package/frontend-vue/tests/support/onboarding.ts +0 -176
- package/frontend-vue/tests/support/panel-fixtures.ts +0 -155
- package/frontend-vue/tests/support/panel-harness.ts +0 -211
- package/frontend-vue/tests/support/setup-layout.ts +0 -3
- package/frontend-vue/tests/support/stand-ins/DmsBlockPreview.ts +0 -18
- package/frontend-vue/tests/support/stand-ins/DmsEmptyState.ts +0 -17
- package/frontend-vue/tests/support/stand-ins/DmsSegmentedControl.ts +0 -35
- package/frontend-vue/tests/support/stand-ins/DmsStatusPill.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/OnboardingModal.ts +0 -13
- package/frontend-vue/tests/support/stand-ins/UBadge.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/UButton.ts +0 -27
- package/frontend-vue/tests/support/stand-ins/UCheckbox.ts +0 -25
- package/frontend-vue/tests/support/stand-ins/UDropdownMenu.ts +0 -34
- package/frontend-vue/tests/support/stand-ins/UFormField.ts +0 -9
- package/frontend-vue/tests/support/stand-ins/UInput.ts +0 -16
- package/frontend-vue/tests/support/stand-ins/UKbd.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/UModal.ts +0 -20
- package/frontend-vue/tests/support/stand-ins/UPopover.ts +0 -9
- package/frontend-vue/tests/support/stand-ins/UTabs.ts +0 -31
- package/frontend-vue/tests/support/stand-ins/UTextarea.ts +0 -19
- package/frontend-vue/tests/support/stubs.ts +0 -28
- package/frontend-vue/tests/views/api-data-reads.test.ts +0 -451
- package/frontend-vue/tests/views/api-error-presentation.test.ts +0 -89
- package/frontend-vue/tests/views/diff-view.test.ts +0 -167
- package/frontend-vue/tests/views/use-assistant.test.ts +0 -53
- package/frontend-vue/tests/views/view-format.test.ts +0 -59
- package/frontend-vue/vitest.config.ts +0 -33
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { afterEach, expect, it, vi } from "vitest";
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import { useAiData } from "../../app/views/composables/useAiData";
|
|
4
|
-
import { useChangeSetActions } from "../../app/views/composables/useChangeSetActions";
|
|
5
|
-
import { installApiErrorPresenter } from "../support/api-error-presenter";
|
|
6
|
-
|
|
7
|
-
afterEach(() => vi.unstubAllGlobals());
|
|
8
|
-
|
|
9
|
-
it.each([
|
|
10
|
-
{
|
|
11
|
-
status: 403,
|
|
12
|
-
data: { message: "error.read_only_demo", severity: "warning" },
|
|
13
|
-
title: "This demo is read-only.",
|
|
14
|
-
color: "warning",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
status: 403,
|
|
18
|
-
data: { message: "unknown.server.key" },
|
|
19
|
-
title: "Could not load the assistant's data.",
|
|
20
|
-
color: "warning",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
status: 503,
|
|
24
|
-
data: { message: "unknown.server.key" },
|
|
25
|
-
title: "The assistant is not running.",
|
|
26
|
-
color: "error",
|
|
27
|
-
},
|
|
28
|
-
])(
|
|
29
|
-
"presents redo failure $status once with server or fallback copy",
|
|
30
|
-
async ({ status, data, title, color }) => {
|
|
31
|
-
const { add } = installApiErrorPresenter();
|
|
32
|
-
const error = Object.assign(new Error("Request failed"), {
|
|
33
|
-
response: new Response(JSON.stringify(data), {
|
|
34
|
-
status,
|
|
35
|
-
headers: { "content-type": "application/json" },
|
|
36
|
-
}),
|
|
37
|
-
data,
|
|
38
|
-
});
|
|
39
|
-
vi.stubGlobal("useI18n", () => ({ t: (key: string) => key }));
|
|
40
|
-
vi.stubGlobal("useConfirmFrom", () => ({}));
|
|
41
|
-
vi.stubGlobal("useAuthFetch", () => ({
|
|
42
|
-
$authFetch: async () => {
|
|
43
|
-
throw error;
|
|
44
|
-
},
|
|
45
|
-
}));
|
|
46
|
-
const actions = useChangeSetActions();
|
|
47
|
-
const changeSet = {
|
|
48
|
-
id: "change-1",
|
|
49
|
-
number: 1,
|
|
50
|
-
conversationId: "conversation-1",
|
|
51
|
-
title: "Rename page",
|
|
52
|
-
createdAtMs: 1,
|
|
53
|
-
agent: "claude",
|
|
54
|
-
scope: "safe",
|
|
55
|
-
isAutoFix: false,
|
|
56
|
-
overlapped: false,
|
|
57
|
-
files: [],
|
|
58
|
-
added: 1,
|
|
59
|
-
removed: 0,
|
|
60
|
-
typecheck: "passed",
|
|
61
|
-
state: "applied",
|
|
62
|
-
approvalsNeeded: 0,
|
|
63
|
-
builderOps: 0,
|
|
64
|
-
} satisfies Parameters<typeof actions.redo>[0];
|
|
65
|
-
await actions.redo(changeSet);
|
|
66
|
-
await actions.redo(changeSet);
|
|
67
|
-
expect(add.mock.calls).toEqual([
|
|
68
|
-
[expect.objectContaining({ title, color })],
|
|
69
|
-
]);
|
|
70
|
-
expect(actions.isBusy.value).toBe(false);
|
|
71
|
-
},
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
it("resolves a JSON read refusal as translated inline copy without a toast", () => {
|
|
75
|
-
const { add } = installApiErrorPresenter();
|
|
76
|
-
const data = { message: "error.read_only_demo", severity: "warning" };
|
|
77
|
-
const error = Object.assign(new Error("Forbidden"), {
|
|
78
|
-
response: new Response(JSON.stringify(data), { status: 403 }),
|
|
79
|
-
data,
|
|
80
|
-
});
|
|
81
|
-
vi.stubGlobal("useApiData", () => ({
|
|
82
|
-
error: ref(error),
|
|
83
|
-
status: ref("error"),
|
|
84
|
-
}));
|
|
85
|
-
const read = useAiData("/ai/changes");
|
|
86
|
-
expect(read.failure.value).toBe("error");
|
|
87
|
-
expect(read.message.value).toBe("This demo is read-only.");
|
|
88
|
-
expect(add).not.toHaveBeenCalled();
|
|
89
|
-
});
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import DiffView from "../../app/views/DiffView.vue";
|
|
5
|
-
import type { DiffFile } from "../../app/views/types";
|
|
6
|
-
import {
|
|
7
|
-
countLines,
|
|
8
|
-
hunkHeader,
|
|
9
|
-
renderHunks,
|
|
10
|
-
} from "../../app/views/utils/diff";
|
|
11
|
-
|
|
12
|
-
const PAGE_FILE: DiffFile = {
|
|
13
|
-
path: "src/modules/sales/pages/overview.page.ts",
|
|
14
|
-
status: "modified",
|
|
15
|
-
added: 2,
|
|
16
|
-
removed: 1,
|
|
17
|
-
hunks: [
|
|
18
|
-
{
|
|
19
|
-
oldStart: 38,
|
|
20
|
-
newStart: 38,
|
|
21
|
-
lines: [
|
|
22
|
-
{
|
|
23
|
-
kind: "context",
|
|
24
|
-
text: " static revenue = ChartCard();",
|
|
25
|
-
oldLine: 38,
|
|
26
|
-
newLine: 38,
|
|
27
|
-
},
|
|
28
|
-
{ kind: "remove", text: " static latest = TableView();", oldLine: 39 },
|
|
29
|
-
{ kind: "add", text: " static top = TopListCard();", newLine: 39 },
|
|
30
|
-
{ kind: "add", text: " static latest = TableView();", newLine: 40 },
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const NEW_FILE: DiffFile = {
|
|
37
|
-
path: "src/modules/sales/queries/top-customers.ts",
|
|
38
|
-
status: "added",
|
|
39
|
-
hunks: [
|
|
40
|
-
{
|
|
41
|
-
oldStart: 0,
|
|
42
|
-
newStart: 1,
|
|
43
|
-
lines: [{ kind: "add", text: "export const top = 5;", newLine: 1 }],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const STUBS = {
|
|
49
|
-
UIcon: true,
|
|
50
|
-
UButton: {
|
|
51
|
-
props: ["ariaLabel", "icon"],
|
|
52
|
-
emits: ["click"],
|
|
53
|
-
template: `<button :aria-label="ariaLabel" @click="$emit('click')" />`,
|
|
54
|
-
},
|
|
55
|
-
DmsStatusPill: {
|
|
56
|
-
props: ["label"],
|
|
57
|
-
template: `<span data-pill>{{ label }}</span>`,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
function mountDiff(files: DiffFile[]) {
|
|
62
|
-
return mount(DiffView, { props: { files }, global: { stubs: STUBS } });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
beforeEach(() => {
|
|
66
|
-
vi.stubGlobal("useI18n", () => ({
|
|
67
|
-
t: (key: string, params?: Record<string, unknown>) =>
|
|
68
|
-
params?.path ? `${key}:${String(params.path)}` : key,
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
afterEach(() => {
|
|
73
|
-
vi.unstubAllGlobals();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
describe("diff utils", () => {
|
|
77
|
-
it("writes a unified hunk header from the hunk's lines", () => {
|
|
78
|
-
expect(hunkHeader(PAGE_FILE.hunks[0]!)).toBe("@@ -38,2 +38,3 @@");
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("counts added and removed lines", () => {
|
|
82
|
-
expect(countLines(PAGE_FILE.hunks)).toEqual({ added: 2, removed: 1 });
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("numbers removed lines on the old side and the rest on the new side", () => {
|
|
86
|
-
const lines = renderHunks(PAGE_FILE.hunks);
|
|
87
|
-
expect(lines.map((line) => [line.kind, line.number, line.marker])).toEqual([
|
|
88
|
-
["hunk", "", ""],
|
|
89
|
-
["context", "38", ""],
|
|
90
|
-
["remove", "39", "−"],
|
|
91
|
-
["add", "39", "+"],
|
|
92
|
-
["add", "40", "+"],
|
|
93
|
-
]);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("DiffView", () => {
|
|
98
|
-
it("draws each file with its directory, name and counts", () => {
|
|
99
|
-
const wrapper = mountDiff([PAGE_FILE]);
|
|
100
|
-
const header = wrapper.get("[data-diff-file] header");
|
|
101
|
-
expect(header.text()).toContain("src/modules/sales/pages/");
|
|
102
|
-
expect(header.get("b").text()).toBe("overview.page.ts");
|
|
103
|
-
expect(header.text()).toContain("+2");
|
|
104
|
-
expect(header.text()).toContain("−1");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("colours lines by kind and keeps their text verbatim", () => {
|
|
108
|
-
const wrapper = mountDiff([PAGE_FILE]);
|
|
109
|
-
const kinds = wrapper
|
|
110
|
-
.findAll("[data-line-kind]")
|
|
111
|
-
.map((row) => row.attributes("data-line-kind"));
|
|
112
|
-
expect(kinds).toEqual(["hunk", "context", "remove", "add", "add"]);
|
|
113
|
-
const removed = wrapper.get('[data-line-kind="remove"]');
|
|
114
|
-
expect(removed.classes().join(" ")).toContain("error");
|
|
115
|
-
expect(removed.findAll("span").at(2)?.text()).toBe(
|
|
116
|
-
"static latest = TableView();",
|
|
117
|
-
);
|
|
118
|
-
expect(wrapper.get('[data-line-kind="add"]').classes().join(" ")).toContain(
|
|
119
|
-
"success",
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("marks a new file and derives its counts from the hunks", () => {
|
|
124
|
-
const wrapper = mountDiff([NEW_FILE]);
|
|
125
|
-
expect(wrapper.get("[data-pill]").text()).toBe(
|
|
126
|
-
"dms_assistant.views.diff.new",
|
|
127
|
-
);
|
|
128
|
-
expect(wrapper.get("header").text()).toContain("+1");
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("collapses and expands a file", async () => {
|
|
132
|
-
const wrapper = mountDiff([PAGE_FILE]);
|
|
133
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(5);
|
|
134
|
-
await wrapper.get("header button").trigger("click");
|
|
135
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(0);
|
|
136
|
-
await wrapper.get("header button").trigger("click");
|
|
137
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(5);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("opens a long file collapsed, the first one included, and draws it on demand", async () => {
|
|
141
|
-
const added = Array.from({ length: 201 }, (_, index) => ({
|
|
142
|
-
kind: "add" as const,
|
|
143
|
-
text: `export const line${index} = ${index};`,
|
|
144
|
-
newLine: index + 1,
|
|
145
|
-
}));
|
|
146
|
-
const wrapper = mountDiff([
|
|
147
|
-
{ ...NEW_FILE, hunks: [{ oldStart: 0, newStart: 1, lines: added }] },
|
|
148
|
-
PAGE_FILE,
|
|
149
|
-
]);
|
|
150
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(5);
|
|
151
|
-
await wrapper.get("header button").trigger("click");
|
|
152
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(207);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it("says so for a binary file instead of drawing lines", () => {
|
|
156
|
-
const wrapper = mountDiff([
|
|
157
|
-
{
|
|
158
|
-
path: "public/logo.png",
|
|
159
|
-
status: "modified",
|
|
160
|
-
hunks: [],
|
|
161
|
-
isBinary: true,
|
|
162
|
-
},
|
|
163
|
-
]);
|
|
164
|
-
expect(wrapper.text()).toContain("dms_assistant.views.diff.binary");
|
|
165
|
-
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(0);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { createSSRApp, defineComponent, h, nextTick, shallowRef } from "vue";
|
|
4
|
-
import { renderToString } from "vue/server-renderer";
|
|
5
|
-
import type { AssistantSession } from "../../app/runtime/assistant-session";
|
|
6
|
-
import { ASSISTANT_SESSION_KEY } from "../../app/runtime/assistant-session";
|
|
7
|
-
import { useAssistant } from "../../app/views/composables/useAssistant";
|
|
8
|
-
|
|
9
|
-
vi.mock("#dms/frontend-module", () => ({
|
|
10
|
-
useDmsRouter: () => ({ push: vi.fn() }),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
// A view offering an assistant button, as the Changes empty state does.
|
|
14
|
-
const View = defineComponent({
|
|
15
|
-
setup() {
|
|
16
|
-
const assistant = useAssistant();
|
|
17
|
-
return () =>
|
|
18
|
-
h("div", [assistant.isAvailable ? h("button", "Open assistant") : null]);
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function appWith(session: AssistantSession | null) {
|
|
23
|
-
const app = createSSRApp(View);
|
|
24
|
-
app.provide(ASSISTANT_SESSION_KEY, shallowRef(session));
|
|
25
|
-
return app;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
document.body.innerHTML = "";
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe("useAssistant", () => {
|
|
33
|
-
it("hydrates what the server rendered when the session started first, then offers the assistant", async () => {
|
|
34
|
-
const html = await renderToString(appWith(null));
|
|
35
|
-
const root = document.createElement("div");
|
|
36
|
-
root.innerHTML = html;
|
|
37
|
-
document.body.append(root);
|
|
38
|
-
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
39
|
-
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
40
|
-
|
|
41
|
-
// The tab's probe answered before this block hydrated.
|
|
42
|
-
appWith({} as AssistantSession).mount(root);
|
|
43
|
-
const mismatches = [...warn.mock.calls, ...error.mock.calls]
|
|
44
|
-
.flat()
|
|
45
|
-
.filter((entry) => String(entry).includes("Hydration"));
|
|
46
|
-
warn.mockRestore();
|
|
47
|
-
error.mockRestore();
|
|
48
|
-
expect(mismatches).toEqual([]);
|
|
49
|
-
|
|
50
|
-
await nextTick();
|
|
51
|
-
expect(root.querySelector("button")?.textContent).toBe("Open assistant");
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatMoment, type MomentOptions } from "../../app/views/utils/moment";
|
|
3
|
-
import {
|
|
4
|
-
bareToolName,
|
|
5
|
-
readableToolName,
|
|
6
|
-
toolSource,
|
|
7
|
-
} from "../../app/views/utils/tools";
|
|
8
|
-
|
|
9
|
-
const NOW_MS = Date.UTC(2026, 8, 29, 15, 30);
|
|
10
|
-
const HOUR_MS = 3_600_000;
|
|
11
|
-
const DAY_MS = 24 * HOUR_MS;
|
|
12
|
-
|
|
13
|
-
function options(): MomentOptions {
|
|
14
|
-
return {
|
|
15
|
-
format: (intlOptions) =>
|
|
16
|
-
new Intl.DateTimeFormat("en-US", {
|
|
17
|
-
...intlOptions,
|
|
18
|
-
timeZone: "UTC",
|
|
19
|
-
hourCycle: "h23",
|
|
20
|
-
}),
|
|
21
|
-
t: (key, params) => `${key.split(".").at(-1)} ${String(params?.time)}`,
|
|
22
|
-
nowMs: NOW_MS,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe("formatMoment", () => {
|
|
27
|
-
it("says today and yesterday with the time", () => {
|
|
28
|
-
expect(formatMoment(NOW_MS - HOUR_MS, options())).toBe("today 14:30");
|
|
29
|
-
expect(formatMoment(NOW_MS - DAY_MS, options())).toBe("yesterday 15:30");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("names the weekday within the week, then the day", () => {
|
|
33
|
-
expect(formatMoment(NOW_MS - 3 * DAY_MS, options())).toBe("Sat 15:30");
|
|
34
|
-
expect(formatMoment(NOW_MS - 10 * DAY_MS, options())).toBe("Sep 19");
|
|
35
|
-
expect(formatMoment(NOW_MS - 400 * DAY_MS, options())).toBe("Aug 25, 2025");
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe("tool names", () => {
|
|
40
|
-
it("drops the MCP namespace", () => {
|
|
41
|
-
expect(bareToolName("mcp__dms-builder__builder_add_block")).toBe(
|
|
42
|
-
"builder_add_block",
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("writes an unknown tool as words", () => {
|
|
47
|
-
expect(readableToolName("mcp__dms-builder__builder_add_block")).toBe(
|
|
48
|
-
"Add block",
|
|
49
|
-
);
|
|
50
|
-
expect(readableToolName("command_execution")).toBe("Command execution");
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("places a tool in its source", () => {
|
|
54
|
-
expect(toolSource("mcp__dms-builder__builder_add_block")).toBe("builder");
|
|
55
|
-
expect(toolSource("Edit")).toBe("code");
|
|
56
|
-
expect(toolSource("WebFetch")).toBe("web");
|
|
57
|
-
expect(toolSource("Something")).toBe("assistant");
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import vue from "@vitejs/plugin-vue";
|
|
3
|
-
import { defineConfig } from "vitest/config";
|
|
4
|
-
import { backendBoundary } from "./build/backend-boundary.ts";
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [backendBoundary(), vue()],
|
|
8
|
-
resolve: {
|
|
9
|
-
alias: {
|
|
10
|
-
// The renderer's runtime exists in the generated application only.
|
|
11
|
-
"#dms/frontend-module": resolve(
|
|
12
|
-
__dirname,
|
|
13
|
-
"tests/support/dms-frontend-module.ts",
|
|
14
|
-
),
|
|
15
|
-
"#dms-core": resolve(
|
|
16
|
-
__dirname,
|
|
17
|
-
"node_modules/@antelopejs/dms/frontend-vue/layers/dms-core",
|
|
18
|
-
),
|
|
19
|
-
"#dms-ui": resolve(
|
|
20
|
-
__dirname,
|
|
21
|
-
"node_modules/@antelopejs/dms/frontend-vue/layers/dms-ui",
|
|
22
|
-
),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
test: {
|
|
26
|
-
// Most suites need no DOM, and setting jsdom up per file is the bulk of
|
|
27
|
-
// the run; the files that mount components opt in with a
|
|
28
|
-
// `// @vitest-environment jsdom` header.
|
|
29
|
-
environment: "node",
|
|
30
|
-
include: ["tests/**/*.test.ts"],
|
|
31
|
-
setupFiles: ["tests/support/setup-layout.ts"],
|
|
32
|
-
},
|
|
33
|
-
});
|