package capture import ( "encoding/json" "testing" ) // TestHyprctlMonitors parses a representative `hyprctl monitors -j` payload. func TestHyprctlMonitors(t *testing.T) { payload := `[ { "id": 0, "name": "eDP-1", "description": "BOE 0x094C", "width": 1920, "height": 1200, "focused": true }, { "id": 1, "name": "HDMI-A-1", "description": "Samsung", "width": 2560, "height": 1440, "focused": false } ]` var raw []hyprctlMonitor if err := json.Unmarshal([]byte(payload), &raw); err != nil { t.Fatalf("unmarshal: %v", err) } if len(raw) != 2 { t.Fatalf("got %d monitors, want 2", len(raw)) } if raw[0].ID != 0 || raw[0].Name != "eDP-1" || raw[0].Width != 1920 { t.Errorf("monitor 0 wrong: %+v", raw[0]) } if raw[1].ID != 1 || raw[1].Focused { t.Errorf("monitor 1 wrong: %+v", raw[1]) } }