(t *testing.T)
| 263 | } |
| 264 | |
| 265 | func TestStatsTracker_UpdateStatsBatch(t *testing.T) { |
| 266 | tracker := New() |
| 267 | ctx := context.Background() |
| 268 | |
| 269 | tracker.UpdateStatsBatch([]Sample{ |
| 270 | { |
| 271 | PublicKey: "key1", |
| 272 | Email: "user1@example.com", |
| 273 | Rx: 1000, |
| 274 | Tx: 2000, |
| 275 | EndpointIP: "1.1.1.1", |
| 276 | }, |
| 277 | { |
| 278 | PublicKey: "key2", |
| 279 | Email: "user2@example.com", |
| 280 | Rx: 3000, |
| 281 | Tx: 4000, |
| 282 | EndpointIP: "2.2.2.2", |
| 283 | }, |
| 284 | }) |
| 285 | |
| 286 | resp := tracker.GetUsersStats(ctx, false) |
| 287 | if len(resp.Stats) != 4 { |
| 288 | t.Fatalf("expected 4 stats, got %d", len(resp.Stats)) |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | func TestStatsTracker_UpdateStatsBatchDuplicateKeyLastWins(t *testing.T) { |
| 293 | tracker := New() |
nothing calls this directly
no test coverage detected