| 66 | } |
| 67 | |
| 68 | func TestAPI_Settings(t *testing.T) { |
| 69 | mux, _ := setupAPI(t) |
| 70 | |
| 71 | r := httptest.NewRequest("GET", "/api/settings", nil) |
| 72 | w := httptest.NewRecorder() |
| 73 | mux.ServeHTTP(w, r) |
| 74 | |
| 75 | var resp map[string]any |
| 76 | json.NewDecoder(w.Body).Decode(&resp) |
| 77 | if resp["version"] != "test-version" { |
| 78 | t.Errorf("version = %q", resp["version"]) |
| 79 | } |
| 80 | events, ok := resp["events"].([]any) |
| 81 | if !ok || len(events) != 2 { |
| 82 | t.Errorf("events = %v", resp["events"]) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func TestAPI_Events_Empty(t *testing.T) { |
| 87 | mux, _ := setupAPI(t) |