b41c1d2501
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { SystemRole } from "@nexus/shared";
|
|
import {
|
|
createToolContext,
|
|
executeTool,
|
|
resetAssistantImportToolTestState,
|
|
} from "./assistant-tools-import-dispo-webhooks-test-helpers.js";
|
|
|
|
describe("assistant export tools", () => {
|
|
beforeEach(async () => {
|
|
await resetAssistantImportToolTestState();
|
|
});
|
|
|
|
it("exports resources CSV through the real import/export router path", async () => {
|
|
const ctx = createToolContext(
|
|
{
|
|
resource: {
|
|
findMany: vi.fn().mockResolvedValue([
|
|
{
|
|
eid: "EMP-001",
|
|
displayName: "Carol Danvers",
|
|
email: "carol@example.com",
|
|
chapter: "Delivery",
|
|
lcrCents: 8000,
|
|
ucrCents: 12000,
|
|
currency: "EUR",
|
|
chargeabilityTarget: 0.8,
|
|
dynamicFields: {},
|
|
},
|
|
]),
|
|
},
|
|
blueprint: {
|
|
findMany: vi.fn().mockResolvedValue([]),
|
|
},
|
|
},
|
|
{ userRole: SystemRole.CONTROLLER },
|
|
);
|
|
|
|
const result = await executeTool("export_resources_csv", "{}", ctx);
|
|
|
|
expect(JSON.parse(result.content)).toEqual({
|
|
format: "csv",
|
|
lineCount: 2,
|
|
csv: "eid,displayName,email,chapter,lcrCents,ucrCents,currency,chargeabilityTarget\nEMP-001,Carol Danvers,carol@example.com,Delivery,8000,12000,EUR,0.8",
|
|
});
|
|
});
|
|
});
|