fix(lint): make compatibility test assertions fatal

This commit is contained in:
wucm667
2026-08-11 16:57:39 +08:00
parent e087f1b736
commit c3fc4331c1
2 changed files with 5 additions and 9 deletions
@@ -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")
}