(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func TestAPI_Events_Empty(t *testing.T) { |
| 87 | mux, _ := setupAPI(t) |
| 88 | |
| 89 | r := httptest.NewRequest("GET", "/api/events", nil) |
| 90 | w := httptest.NewRecorder() |
| 91 | mux.ServeHTTP(w, r) |
| 92 | |
| 93 | var resp map[string]any |
| 94 | json.NewDecoder(w.Body).Decode(&resp) |
| 95 | data, ok := resp["data"].([]any) |
| 96 | if !ok { |
| 97 | t.Fatal("data is not array") |
| 98 | } |
| 99 | if len(data) != 0 { |
| 100 | t.Errorf("len = %d, want 0", len(data)) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func TestAPI_Events_CRUD(t *testing.T) { |
| 105 | mux, store := setupAPI(t) |