(t *testing.T)
| 242 | } |
| 243 | |
| 244 | func TestAPI_Projects(t *testing.T) { |
| 245 | mux, _ := setupAPI(t) |
| 246 | |
| 247 | r := httptest.NewRequest("GET", "/api/projects", nil) |
| 248 | w := httptest.NewRecorder() |
| 249 | mux.ServeHTTP(w, r) |
| 250 | |
| 251 | var resp map[string]any |
| 252 | json.NewDecoder(w.Body).Decode(&resp) |
| 253 | data := resp["data"].([]any) |
| 254 | if len(data) != 1 { |
| 255 | t.Errorf("len = %d, want 1 (default project)", len(data)) |
| 256 | } |
| 257 | proj := data[0].(map[string]any) |
| 258 | if proj["key"] != "default" { |
| 259 | t.Errorf("key = %v", proj["key"]) |
| 260 | } |
| 261 | } |