Skip to content

Commit 933aeb9

Browse files
committed
test(webapp): stub the agent proxy's environment lookup, not a Prisma row
The hand-built row stopped satisfying every column the authenticated-environment mapper reads, so both proxy cases failed. Stubbing the lookup keeps the fixture independent of the row's columns.
1 parent 82f4a73 commit 933aeb9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/webapp/test/dashboardAgentWatchInvestigate.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,14 @@ vi.mock("~/models/project.server", () => ({
8484
}));
8585
vi.mock("~/db.server", () => ({
8686
prisma: {},
87-
$replica: {
88-
runtimeEnvironment: { findFirst: async () => ({ id: "env_1", type: "PRODUCTION" }) },
89-
},
87+
$replica: {},
9088
sqlDatabaseSchema: undefined,
9189
}));
90+
// Stub the lookup, not the row: the route only reads id and type, while a raw
91+
// Prisma row has to satisfy every column `toAuthenticated` reads.
92+
vi.mock("~/models/runtimeEnvironment.server", () => ({
93+
findEnvironmentBySlug: async () => ({ id: "env_1", type: "PRODUCTION" }),
94+
}));
9295

9396
const { action } = await import("~/routes/api.v1.dashboard-agent.watches.$watchId.investigate");
9497
const { action: inProxyAction } =

0 commit comments

Comments
 (0)