(t *testing.T)
| 146 | } |
| 147 | |
| 148 | func TestMonitor_SortChangesRowOrder(t *testing.T) { |
| 149 | stats := map[string]*docker.Stats{ |
| 150 | "zzz": {CID: "zzz", NetworkRx: 30, NetworkTx: 5}, |
| 151 | "aaa": {CID: "aaa", NetworkRx: 10, NetworkTx: 2}, |
| 152 | "mmm": {CID: "mmm", NetworkRx: 20, NetworkTx: 3}, |
| 153 | } |
| 154 | m := newTestMonitor(stats) |
| 155 | |
| 156 | // Default sort by column 0 (CONTAINER) ascending → aaa first |
| 157 | first := m.table.SelectedRow() |
| 158 | if first == nil || first.ID() != "aaa" { |
| 159 | t.Fatalf("expected first row 'aaa' sorted by CONTAINER, got %v", first) |
| 160 | } |
| 161 | |
| 162 | // Sort by NET RX/TX (column 4) → lowest network IO (aaa) first |
| 163 | for range 4 { |
| 164 | m, _ = m.Update(tea.KeyPressMsg{Code: tea.KeyF1}) |
| 165 | } |
| 166 | |
| 167 | first = m.table.SelectedRow() |
| 168 | if first == nil || first.ID() != "aaa" { |
| 169 | t.Fatalf("expected first row 'aaa' sorted by NET RX/TX, got %v", first) |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | func TestMonitor_RefreshWithNewContainer(t *testing.T) { |
| 174 | stats := map[string]*docker.Stats{ |
nothing calls this directly
no test coverage detected