see comments

This commit is contained in:
Rajpreet0 2026-10-02 15:36:12 +02:00
parent 7aa887c5aa
commit d91b353dc2
20 changed files with 593 additions and 151 deletions

View file

@ -51,6 +51,28 @@ describe("refundStripePayment", () => {
refundApplicationFee: false,
});
expect(result).toEqual({ success: false, error: "insufficient balance" });
expect(result).toEqual({ success: false, error: "insufficient balance", definitive: false });
});
it("unterscheidet eine sichere Ablehnung von einem offenen Ausgang", async () => {
const rejected = Object.assign(new Error("Charge already refunded"), {
type: "StripeInvalidRequestError",
code: "charge_already_refunded",
});
vi.mocked(stripe.refunds.create).mockRejectedValueOnce(rejected);
const timeout = Object.assign(new Error("timeout"), { type: "StripeConnectionError" });
vi.mocked(stripe.refunds.create).mockRejectedValueOnce(timeout);
const params = {
paymentIntentId: "pi_1",
stripeAccountId: "acct",
refundApplicationFee: false,
};
expect(await refundStripePayment(params)).toMatchObject({
success: false,
definitive: true,
code: "charge_already_refunded",
});
expect(await refundStripePayment(params)).toMatchObject({ success: false, definitive: false });
});
});