mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 11:43:23 +08:00
fix(lint): make compatibility test assertions fatal
This commit is contained in:
@@ -782,9 +782,7 @@ func TestExtractGeminiUsage(t *testing.T) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if got == nil {
|
||||
t.Fatalf("期望返回非 nil,实际返回 nil")
|
||||
}
|
||||
require.NotNil(t, got)
|
||||
if got.InputTokens != tt.wantUsage.InputTokens {
|
||||
t.Errorf("InputTokens: 期望 %d,实际 %d", tt.wantUsage.InputTokens, got.InputTokens)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package service
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCodexSnapshotBaseTime(t *testing.T) {
|
||||
@@ -50,9 +52,7 @@ func TestCodexResetAtRFC3339(t *testing.T) {
|
||||
t.Run("positive seconds", func(t *testing.T) {
|
||||
sec := 90
|
||||
got := codexResetAtRFC3339(base, &sec)
|
||||
if got == nil {
|
||||
t.Fatal("expected non-nil")
|
||||
}
|
||||
require.NotNil(t, got)
|
||||
if *got != "2026-02-16T10:01:30Z" {
|
||||
t.Fatalf("got %s, want %s", *got, "2026-02-16T10:01:30Z")
|
||||
}
|
||||
@@ -61,9 +61,7 @@ func TestCodexResetAtRFC3339(t *testing.T) {
|
||||
t.Run("negative seconds clamp to base", func(t *testing.T) {
|
||||
sec := -3
|
||||
got := codexResetAtRFC3339(base, &sec)
|
||||
if got == nil {
|
||||
t.Fatal("expected non-nil")
|
||||
}
|
||||
require.NotNil(t, got)
|
||||
if *got != "2026-02-16T10:00:00Z" {
|
||||
t.Fatalf("got %s, want %s", *got, "2026-02-16T10:00:00Z")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user