MCPcopy
hub / github.com/moncho/dry / TestMonitor_SortChangesRowOrder

Function TestMonitor_SortChangesRowOrder

appui/monitor_model_test.go:148–171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func 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
173func TestMonitor_RefreshWithNewContainer(t *testing.T) {
174 stats := map[string]*docker.Stats{

Callers

nothing calls this directly

Calls 4

newTestMonitorFunction · 0.85
SelectedRowMethod · 0.80
IDMethod · 0.65
UpdateMethod · 0.45

Tested by

no test coverage detected