fix(payment): hide first recharge banner
Docker Image / Build and Push Docker Image (push) Successful in 2m18s

This commit is contained in:
Codex
2026-07-28 11:10:51 +08:00
parent ed822c159f
commit 995fdbda57
4 changed files with 123 additions and 28 deletions
@@ -3,8 +3,12 @@ import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { Result } from "@/utils/result";
import { ApiError } from "@/data/services/api/api_result";
import { SubscriptionPaymentIssueDialog } from "../subscription-payment-issue-dialog";
import {
getPaymentIssueSubmitErrorLogDetails,
SubscriptionPaymentIssueDialog,
} from "../subscription-payment-issue-dialog";
import { SubscriptionRenewalConfirmationDialog } from "../subscription-renewal-confirmation-dialog";
const mocks = vi.hoisted(() => ({
@@ -200,6 +204,28 @@ describe("subscription payment dialogs", () => {
);
expect(onClose).toHaveBeenCalledOnce();
});
it("keeps HTTP status and backend error code in payment issue failure diagnostics", () => {
const failure = Result.err(
new ApiError("HTTP_ERROR", "Invalid feedback context", 400, {
detail: {
message: "Invalid feedback context",
errorCode: "INVALID_FEEDBACK_CONTEXT",
},
}),
);
if (failure.success) throw new Error("Expected failure result");
expect(getPaymentIssueSubmitErrorLogDetails(failure.error)).toMatchObject({
code: "UNKNOWN",
message: "Invalid feedback context",
causeName: "ApiError",
causeMessage: "Invalid feedback context",
httpStatus: 400,
apiCode: "HTTP_ERROR",
serverErrorCode: "INVALID_FEEDBACK_CONTEXT",
});
});
});
function clickButton(root: ParentNode | null, label: string): void {