feat: show current-cycle daily token peak
This commit is contained in:
@@ -331,6 +331,24 @@ func TestCurrentTokenCycleRequiresAValidFutureResetWindow(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPeakDailyTokensUsesOnlyTheCurrentTokenCycle(t *testing.T) {
|
||||
now := time.Date(2026, time.August, 14, 12, 0, 0, 0, time.UTC)
|
||||
cycle := &TokenCycle{
|
||||
StartedAt: time.Date(2026, time.August, 8, 0, 0, 0, 0, time.UTC).Unix(),
|
||||
ResetsAt: time.Date(2026, time.August, 15, 0, 0, 0, 0, time.UTC).Unix(),
|
||||
}
|
||||
peak := peakDailyTokensForCycle(cycle, []UsagePoint{
|
||||
{Date: "2026-08-07", TotalTokens: 900},
|
||||
{Date: "2026-08-08", TotalTokens: 100},
|
||||
{Date: "2026-08-10", TotalTokens: 200},
|
||||
{Date: "2026-08-14", TotalTokens: 300},
|
||||
{Date: "2026-08-15", TotalTokens: 800},
|
||||
}, now.Unix())
|
||||
if peak == nil || *peak != 300 {
|
||||
t.Fatalf("cycle peak = %v; want 300", peak)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFlattenLimitReadsAppServerWindowDuration(t *testing.T) {
|
||||
var limit rawLimit
|
||||
if err := json.Unmarshal([]byte(`{
|
||||
|
||||
Reference in New Issue
Block a user