MCPcopy Create free account
hub / github.com/Cawlumm/lyftr / TestListPrograms_empty

Function TestListPrograms_empty

backend/controllers/programs_test.go:11–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func 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
31func TestCreateProgram_success(t *testing.T) {
32 setupTestDB(t)

Callers

nothing calls this directly

Calls 5

setupTestDBFunction · 0.85
createTestUserFunction · 0.85
newContextFunction · 0.85
decodeResponseFunction · 0.85
ListProgramsMethod · 0.80

Tested by

no test coverage detected