MCPcopy Create free account
hub / github.com/compozy/agh / TestStatusForTaskError

Function TestStatusForTaskError

internal/api/core/tasks_test.go:125–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestStatusForTaskError(t *testing.T) {
126 t.Parallel()
127
128 testCases := []struct {
129 name string
130 err error
131 want int
132 }{
133 {name: "validation", err: core.NewTaskValidationError(context.Canceled), want: http.StatusBadRequest},
134 {name: "payload too large", err: taskpkg.ErrPayloadTooLarge, want: http.StatusRequestEntityTooLarge},
135 {name: "permission denied", err: taskpkg.ErrPermissionDenied, want: http.StatusForbidden},
136 {name: "task not found", err: taskpkg.ErrTaskNotFound, want: http.StatusNotFound},
137 {name: "workspace missing", err: workspacepkg.ErrWorkspaceNotFound, want: http.StatusNotFound},
138 {name: "invalid transition", err: taskpkg.ErrInvalidStatusTransition, want: http.StatusConflict},
139 {name: "stale network channel", err: taskpkg.ErrStaleNetworkChannel, want: http.StatusConflict},
140 }
141
142 for _, tc := range testCases {
143 t.Run(tc.name, func(t *testing.T) {
144 t.Parallel()
145
146 if got := core.StatusForTaskError(tc.err); got != tc.want {
147 t.Fatalf("StatusForTaskError(%v) = %d, want %d", tc.err, got, tc.want)
148 }
149 })
150 }
151}
152
153func TestBaseHandlersTaskExecutionProfileEndpoints(t *testing.T) {
154 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewTaskValidationErrorFunction · 0.92
StatusForTaskErrorFunction · 0.92
RunMethod · 0.65

Tested by

no test coverage detected