(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestListPrograms_empty(t *testing.T) { |
| 12 | setupTestDB(t) |
| 13 | uid := createTestUser(t) |
| 14 | |
| 15 | c, w := newContext(uid, http.MethodGet, "/api/v1/programs", nil) |
| 16 | th.ListPrograms(c) |
| 17 | |
| 18 | if w.Code != http.StatusOK { |
| 19 | t.Fatalf("expected 200, got %d: %s", w.Code, w.Body.String()) |
| 20 | } |
| 21 | resp := decodeResponse(t, w) |
| 22 | data, ok := resp["data"].([]any) |
| 23 | if !ok { |
| 24 | t.Fatalf("expected data array, got %T", resp["data"]) |
| 25 | } |
| 26 | if len(data) != 0 { |
| 27 | t.Fatalf("expected empty list, got %d items", len(data)) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func TestCreateProgram_success(t *testing.T) { |
| 32 | setupTestDB(t) |
nothing calls this directly
no test coverage detected