fix(lint): make remaining pointer assertions explicit

This commit is contained in:
wucm667
2026-08-11 16:57:39 +08:00
parent 5ea03c178d
commit 145b0ac35e
2 changed files with 8 additions and 15 deletions
@@ -9,6 +9,7 @@ import (
dbent "github.com/Wei-Shaw/sub2api/ent"
"github.com/Wei-Shaw/sub2api/internal/payment"
infraerrors "github.com/Wei-Shaw/sub2api/internal/pkg/errors"
"github.com/stretchr/testify/require"
)
func TestShouldUseAlipayMobilePrecreate(t *testing.T) {
@@ -389,15 +390,11 @@ func TestMaybeBuildWeChatOAuthRequiredResponse(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if resp == nil {
t.Fatal("expected oauth_required response, got nil")
}
require.NotNil(t, resp)
if resp.ResultType != payment.CreatePaymentResultOAuthRequired {
t.Fatalf("result type = %q, want %q", resp.ResultType, payment.CreatePaymentResultOAuthRequired)
}
if resp.OAuth == nil {
t.Fatal("expected oauth payload, got nil")
}
require.NotNil(t, resp.OAuth)
if resp.OAuth.AppID != "wx123456" {
t.Fatalf("appid = %q, want %q", resp.OAuth.AppID, "wx123456")
}
@@ -503,9 +500,7 @@ func TestMaybeBuildWeChatOAuthRequiredResponseFallsBackToConfiguredLegacySigning
if err != nil {
t.Fatalf("expected nil error, got %v", err)
}
if resp == nil {
t.Fatal("expected oauth-required response, got nil")
}
require.NotNil(t, resp)
if resp.ResultType != payment.CreatePaymentResultOAuthRequired {
t.Fatalf("result type = %q, want %q", resp.ResultType, payment.CreatePaymentResultOAuthRequired)
}
@@ -5,6 +5,8 @@ import (
"strconv"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestCalculateAnthropic429ResetTime_Only5hExceeded(t *testing.T) {
@@ -193,9 +195,7 @@ func TestSelectAnthropicFableWindowLimit_RejectedStatus(t *testing.T) {
headers.Set("anthropic-ratelimit-unified-7d_oi-reset", strconv.FormatInt(reset.Unix(), 10))
limit := selectAnthropicFableWindowLimit(headers, now)
if limit == nil {
t.Fatal("expected non-nil limit")
}
require.NotNil(t, limit)
if !limit.resetAt.Equal(reset) {
t.Errorf("expected resetAt=%v, got %v", reset, limit.resetAt)
}
@@ -214,9 +214,7 @@ func TestSelectAnthropicFableWindowLimit_UtilizationOnly(t *testing.T) {
headers.Set("anthropic-ratelimit-unified-7d_oi-reset", strconv.FormatInt(reset.Unix(), 10))
limit := selectAnthropicFableWindowLimit(headers, now)
if limit == nil {
t.Fatal("expected non-nil limit")
}
require.NotNil(t, limit)
if !limit.resetAt.Equal(reset) {
t.Errorf("expected resetAt=%v, got %v", reset, limit.resetAt)
}