MCPcopy Index your code
hub / github.com/coder/coder / TestWrite

Function TestWrite

coderd/httpapi/httpapi_test.go:61–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestWrite(t *testing.T) {
62 t.Parallel()
63 t.Run("NoErrors", func(t *testing.T) {
64 t.Parallel()
65 ctx := context.Background()
66 rw := httptest.NewRecorder()
67 httpapi.Write(ctx, rw, http.StatusOK, codersdk.Response{
68 Message: "Wow.",
69 })
70 var m map[string]interface{}
71 err := json.NewDecoder(rw.Body).Decode(&m)
72 require.NoError(t, err)
73 _, ok := m["errors"]
74 require.False(t, ok)
75 })
76}
77
78func TestRead(t *testing.T) {
79 t.Parallel()

Callers

nothing calls this directly

Calls 2

WriteFunction · 0.92
RunMethod · 0.65

Tested by

no test coverage detected