MCPcopy Create free account
hub / github.com/PasarGuard/node / TestStatsTracker_AnyActiveSince

Function TestStatsTracker_AnyActiveSince

pkg/stats/tracker_test.go:224–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestStatsTracker_AnyActiveSince(t *testing.T) {
225 tracker := New()
226
227 updateSample(tracker, "key1", "user@example.com", 100, 0, "1.2.3.4")
228
229 if !tracker.AnyActiveSince([]string{"key1"}, time.Now().Add(-time.Hour)) {
230 t.Fatal("expected key to be active for old cutoff")
231 }
232
233 if tracker.AnyActiveSince([]string{"key1"}, time.Now().Add(time.Hour)) {
234 t.Fatal("did not expect key to be active for future cutoff")
235 }
236}
237
238func TestStatsTracker_EndpointActivityReturnsNewestPerIP(t *testing.T) {
239 tracker := New()

Callers

nothing calls this directly

Calls 3

updateSampleFunction · 0.85
AnyActiveSinceMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected