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>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { SystemRole } from "@nexus/shared";
|
|
import { TRPCError } from "@trpc/server";
|
|
import { createToolContext, executeTool } from "./assistant-tools-project-test-helpers.js";
|
|
|
|
describe("assistant project read tools - errors", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("returns a generic assistant error for internal project lookup failures", async () => {
|
|
const ctx = createToolContext(
|
|
{
|
|
project: {
|
|
findUnique: vi.fn().mockRejectedValue(
|
|
new TRPCError({
|
|
code: "INTERNAL_SERVER_ERROR",
|
|
message: "database connection pool exhausted",
|
|
}),
|
|
),
|
|
},
|
|
},
|
|
{ userRole: SystemRole.CONTROLLER },
|
|
);
|
|
|
|
const result = await executeTool("get_project", JSON.stringify({ identifier: "GDM" }), ctx);
|
|
|
|
expect(JSON.parse(result.content)).toEqual({
|
|
error: "The tool could not complete due to an internal error.",
|
|
});
|
|
});
|
|
});
|