fix(payment): inherit chat recipient without selector
This commit is contained in:
@@ -105,25 +105,28 @@ describe("payment order flow", () => {
|
||||
actor.stop();
|
||||
});
|
||||
|
||||
it("binds a default VIP or credit order to the selected support character", async () => {
|
||||
const createOrderSpy = vi.fn<CreateOrderSpy>();
|
||||
const actor = createActor(
|
||||
createTestPaymentMachine({ createOrderSpy }),
|
||||
).start();
|
||||
actor.send({ type: "PaymentInit", characterId: "maya-tan" });
|
||||
await waitFor(actor, (snapshot) => snapshot.matches("ready"));
|
||||
it.each(["elio", "maya-tan", "nayeli-cervantes"])(
|
||||
"binds a default VIP or credit order to the source chat character %s",
|
||||
async (characterId) => {
|
||||
const createOrderSpy = vi.fn<CreateOrderSpy>();
|
||||
const actor = createActor(
|
||||
createTestPaymentMachine({ createOrderSpy }),
|
||||
).start();
|
||||
actor.send({ type: "PaymentInit", characterId });
|
||||
await waitFor(actor, (snapshot) => snapshot.matches("ready"));
|
||||
|
||||
actor.send({ type: "PaymentCreateOrderSubmitted" });
|
||||
await waitFor(actor, (snapshot) => snapshot.matches("paid"));
|
||||
actor.send({ type: "PaymentCreateOrderSubmitted" });
|
||||
await waitFor(actor, (snapshot) => snapshot.matches("paid"));
|
||||
|
||||
expect(createOrderSpy).toHaveBeenCalledWith({
|
||||
planId: "vip_monthly",
|
||||
payChannel: "stripe",
|
||||
autoRenew: true,
|
||||
recipientCharacterId: "maya-tan",
|
||||
});
|
||||
actor.stop();
|
||||
});
|
||||
expect(createOrderSpy).toHaveBeenCalledWith({
|
||||
planId: "vip_monthly",
|
||||
payChannel: "stripe",
|
||||
autoRenew: true,
|
||||
recipientCharacterId: characterId,
|
||||
});
|
||||
actor.stop();
|
||||
},
|
||||
);
|
||||
|
||||
it("carries the originating chat action into order creation", async () => {
|
||||
const createOrderSpy = vi.fn<CreateOrderSpy>();
|
||||
|
||||
Reference in New Issue
Block a user