MCPcopy
hub / github.com/pocketbase/pocketbase / TestEventError

Function TestEventError

tools/router/event_test.go:673–682  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

671}
672
673func TestEventError(t *testing.T) {
674 err := new(router.Event).Error(123, "message_test", map[string]any{"a": validation.Required, "b": "test"})
675
676 result, _ := json.Marshal(err)
677 expected := `{"data":{"a":{"code":"validation_invalid_value","message":"Invalid value."},"b":{"code":"validation_invalid_value","message":"Invalid value."}},"message":"Message_test.","status":123}`
678
679 if string(result) != expected {
680 t.Errorf("Expected\n%s\ngot\n%s", expected, result)
681 }
682}
683
684func TestEventBadRequestError(t *testing.T) {
685 err := new(router.Event).BadRequestError("message_test", map[string]any{"a": validation.Required, "b": "test"})

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…