feat: migrate account usage to CLIProxyAPI
Frontend / quality (push) Canceled after 0s

This commit is contained in:
2026-09-08 09:56:08 +08:00
parent 0b2f969c6d
commit 8997886eef
35 changed files with 2778 additions and 1651 deletions
+10
View File
@@ -367,6 +367,13 @@ func reminderDashboard(fetchedAt int64, used float64, resetsAt int64) Dashboard
}
}
func ensureReminderAccount(t *testing.T, a *App) {
t.Helper()
if _, err := a.store.CreateAccount("测试账号", "test-auth"); err != nil {
t.Fatal(err)
}
}
func notificationCount(t *testing.T, a *App) int {
t.Helper()
var count int
@@ -378,6 +385,7 @@ func notificationCount(t *testing.T, a *App) int {
func TestStoreLimitSnapshotsDetectsEarlyReset(t *testing.T) {
a := newReminderTestApp(t)
ensureReminderAccount(t, a)
now := time.Now().Unix()
if detected, err := a.storeLimitSnapshots(reminderDashboard(now, 42, now+3600)); err != nil || detected {
t.Fatalf("initial snapshot: detected=%v err=%v", detected, err)
@@ -433,6 +441,7 @@ func TestLegacyNotificationFormatting(t *testing.T) {
func TestStoreLimitSnapshotsUsesScheduledAfterDedupeKey(t *testing.T) {
a := newReminderTestApp(t)
ensureReminderAccount(t, a)
now := time.Now().Unix()
resetAt := now + 30
_, _ = a.storeLimitSnapshots(reminderDashboard(now, 70, resetAt))
@@ -466,6 +475,7 @@ func TestStoreLimitSnapshotsIgnoresNonResetChanges(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
a := newReminderTestApp(t)
ensureReminderAccount(t, a)
g := defaults()
g.NotifyAfter = tt.notifyAfter
if err := a.store.SetJSON("general", g); err != nil {