A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
import { describe, expect, test } from "vitest";
import { getAssistantToolInputSchema } from "./assistant-tool-schema";
const templateSchema = {
type: "object",
properties: {
sessionId: { type: "string" },
template: { type: "string" },
templateLines: { type: "array", items: { type: "string" } },
},
additionalProperties: false,
};
describe("getAssistantToolInputSchema", () => {
test.each(["customWidget_validateTemplate", "customWidget_previewReviseTemplate"])(
"exposes one compact JSX format for %s",
(toolName) => {
expect(getAssistantToolInputSchema(toolName, templateSchema)).toEqual({
...templateSchema,
properties: {
sessionId: { type: "string" },
templateLines: { type: "array", items: { type: "string" } },
},
required: ["templateLines"],
});
},
);
test("does not alter external or unrelated tool schemas", () => {
expect(getAssistantToolInputSchema("customWidget_previewCreate", templateSchema)).toBe(templateSchema);
expect(getAssistantToolInputSchema("board_getAllBoards", templateSchema)).toBe(templateSchema);
});
test("keeps preview credentials out of the Assistant tool channel", () => {
const schema = {
type: "object",
properties: {
definition: { type: "object" },
secrets: { type: "array", items: { type: "object" } },
definitionId: { type: "string" },
},
required: ["definition", "secrets"],
additionalProperties: false,
};
expect(getAssistantToolInputSchema("customWidget_previewCreate", schema)).toEqual({
...schema,
properties: {
definition: { type: "object" },
definitionId: { type: "string" },
},
required: ["definition"],
});
});
test("omits optional optimistic concurrency from the single-owner Assistant revision tool", () => {
const schema = {
...templateSchema,
properties: {
...templateSchema.properties,
expectedRevision: { type: "integer" },
},
};
expect(getAssistantToolInputSchema("customWidget_previewReviseTemplate", schema)).toMatchObject({
properties: {
sessionId: { type: "string" },
templateLines: { type: "array", items: { type: "string" } },
},
});
expect(getAssistantToolInputSchema("customWidget_previewReviseTemplate", schema).properties).not.toHaveProperty(
"expectedRevision",
);
});
});