iop/apps/node/internal/adapters/cli/status/parser_test.go

28 lines
920 B
Go

package status
import (
"testing"
)
func TestParseStatusOutput_CodexLimits(t *testing.T) {
rawOutput := "5h limit: [████████████████████] 98% left (resets 18:38)\n" +
"Weekly limit: [████░░░░░░░░░░░░░░░░] 22% left (resets 10:20 on 8 May)"
status, err := ParseStatusOutput(rawOutput)
if err != nil {
t.Fatalf("ParseStatusOutput failed: %v", err)
}
if status.DailyLimit != "98%" {
t.Errorf("expected daily limit 98%%, got %q", status.DailyLimit)
}
if status.DailyResetTime != "18:38" {
t.Errorf("expected daily reset 18:38, got %q", status.DailyResetTime)
}
if status.WeeklyLimit != "22%" {
t.Errorf("expected weekly limit 22%%, got %q", status.WeeklyLimit)
}
if status.WeeklyResetTime != "10:20 on 8 May" {
t.Errorf("expected weekly reset 10:20 on 8 May, got %q", status.WeeklyResetTime)
}
}