feat(analytics): add behavior and payment funnel tracking
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
getPaymentUrl,
|
||||
getStripeClientSecret,
|
||||
isEzpayPayment,
|
||||
launchEzpayRedirect,
|
||||
} from "../payment_launch";
|
||||
|
||||
describe("payment launch helpers", () => {
|
||||
@@ -40,4 +41,22 @@ describe("payment launch helpers", () => {
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("reports a launch failure before redirecting without an order id", async () => {
|
||||
const onOpened = vi.fn();
|
||||
const onFailed = vi.fn();
|
||||
|
||||
await launchEzpayRedirect({
|
||||
orderId: null,
|
||||
paymentUrl: "https://pay.example/checkout?token=secret",
|
||||
subscriptionType: "topup",
|
||||
onOpened,
|
||||
onFailed,
|
||||
});
|
||||
|
||||
expect(onOpened).not.toHaveBeenCalled();
|
||||
expect(onFailed).toHaveBeenCalledWith(
|
||||
"Missing order id before opening Ezpay.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user