Files
PaperClipAI/ui/src/components/decision-models/DecisionHistory.test.tsx
T
DottaandPaperclip 2c96f76780 feat(connections): add model-backed prompt injection prevention
Add opt-in OpenRouter checks at existing tool-result boundaries with regex fallback, service accounting, and settings on Connections. Make migration 0362 safe to replay over existing or partially applied schema state.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-20 11:32:25 -05:00

35 lines
1.4 KiB
TypeScript

// @vitest-environment jsdom
import { flushSync } from "react-dom";
import { createRoot } from "react-dom/client";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it, vi } from "vitest";
import { DecisionHistoryTable } from "./DecisionHistory";
vi.mock("@/context/CompanyContext", () => ({
useCompany: () => ({ selectedCompany: { issuePrefix: "ACM" } }),
}));
describe("model history setup links", () => {
it.each([
[false, true, "/ACM/company/settings/connections", "Configure a decision model"],
[false, false, "/ACM/company/settings/connections", "Configure a decision model"],
[true, true, "/ACM/company/settings/connections", "Configure fast response"],
[true, false, "/ACM/company/settings/instance/experimental", "Enable experimental fast responses"],
] as const)("routes setup with fast response %s and experiment %s", (fastResponse, fastResponsesEnabled, href, label) => {
const container = document.createElement("div");
const root = createRoot(container);
try {
flushSync(() => root.render(
<MemoryRouter>
<DecisionHistoryTable entries={[]} fastResponse={fastResponse} fastResponsesEnabled={fastResponsesEnabled} />
</MemoryRouter>,
));
expect(container.querySelector("a")?.getAttribute("href")).toBe(href);
expect(container.querySelector("a")?.textContent).toBe(label);
} finally {
flushSync(() => root.unmount());
}
});
});