MCPcopy
hub / github.com/coder/mux / expectSetGoalError

Function expectSetGoalError

src/node/services/workspaceGoalService.test.ts:2908–2920  ·  view source on GitHub ↗
(
      input: Parameters<WorkspaceGoalService["setGoal"]>[0],
      message: string
    )

Source from the content-addressed store, hash-verified

2906 // it as a typed `invalid_transition` Result error so the oRPC handler
2907 // doesn't leak it as an unhandled 500.
2908 async function expectSetGoalError(
2909 input: Parameters<WorkspaceGoalService["setGoal"]>[0],
2910 message: string
2911 ) {
2912 const result = await service.setGoal(input);
2913 expect(result.success).toBe(false);
2914 if (!result.success) {
2915 expect(result.error.type).toBe("invalid_transition");
2916 if (result.error.type === "invalid_transition") {
2917 expect(result.error.message).toBe(message);
2918 }
2919 }
2920 }
2921
2922 await expectSetGoalError(
2923 { workspaceId, status: "paused" },

Callers 1

Calls 1

setGoalMethod · 0.45

Tested by

no test coverage detected