(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func TestStatsTracker_GetStats(t *testing.T) { |
| 22 | tracker := New() |
| 23 | ctx := context.Background() |
| 24 | |
| 25 | updateSample(tracker, "key1", "user@example.com", 1000, 2000, "1.2.3.4") |
| 26 | |
| 27 | resp := tracker.GetStats(ctx, []string{"key1"}, false) |
| 28 | if len(resp.Stats) != 2 { |
| 29 | t.Fatalf("Expected 2 stats, got %d", len(resp.Stats)) |
| 30 | } |
| 31 | |
| 32 | for _, s := range resp.Stats { |
| 33 | if s.Type == "downlink" && s.Value != 1000 { |
| 34 | t.Errorf("Expected rx=1000, got %d", s.Value) |
| 35 | } |
| 36 | if s.Type == "uplink" && s.Value != 2000 { |
| 37 | t.Errorf("Expected tx=2000, got %d", s.Value) |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestStatsTracker_GetStatsReset(t *testing.T) { |
| 43 | tracker := New() |
nothing calls this directly
no test coverage detected