fix(chat): keep single locked history message unchanged
This commit is contained in:
@@ -453,7 +453,7 @@ describe("chatMachine transitions", () => {
|
||||
actor.stop();
|
||||
});
|
||||
|
||||
it("auto unlocks a single locked image message after payment", async () => {
|
||||
it("keeps a single locked image message locked after payment", async () => {
|
||||
const actor = createActor(
|
||||
createTestChatMachine({
|
||||
historyMessages: [
|
||||
@@ -495,16 +495,15 @@ describe("chatMachine transitions", () => {
|
||||
);
|
||||
|
||||
actor.send({ type: "ChatPaymentSucceeded" });
|
||||
await waitFor(actor, (snapshot) =>
|
||||
snapshot.matches({ userSession: "ready" }),
|
||||
);
|
||||
|
||||
expect(actor.getSnapshot().matches({ userSession: "ready" })).toBe(true);
|
||||
expect(actor.getSnapshot().context.unlockHistoryPromptVisible).toBe(false);
|
||||
expect(actor.getSnapshot().context.messages).toMatchObject([
|
||||
{
|
||||
id: "msg-image-locked",
|
||||
imageUrl: "https://example.com/unlocked.jpg",
|
||||
locked: false,
|
||||
imageUrl: "https://example.com/locked.jpg",
|
||||
imagePaywalled: true,
|
||||
locked: true,
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user