fix(chat): apply unlocked voice audio url
This commit is contained in:
@@ -59,6 +59,7 @@ function makeUnlockPrivateResponse(
|
||||
return UnlockPrivateResponse.from({
|
||||
unlocked: true,
|
||||
content: "unlocked content",
|
||||
audioUrl: "",
|
||||
reason: "ok",
|
||||
creditBalance: 90,
|
||||
creditsCharged: 10,
|
||||
@@ -740,7 +741,7 @@ describe("chatMachine transitions", () => {
|
||||
actor.stop();
|
||||
});
|
||||
|
||||
it("keeps voice message content unchanged after unlock succeeds", async () => {
|
||||
it("applies the real voice audio url after unlock succeeds", async () => {
|
||||
const actor = createActor(
|
||||
createTestChatMachine({
|
||||
historyMessages: [
|
||||
@@ -749,7 +750,6 @@ describe("chatMachine transitions", () => {
|
||||
content: "Original voice transcript.",
|
||||
isFromAI: true,
|
||||
date: "2026-06-29",
|
||||
audioUrl: "https://example.com/voice.mp3",
|
||||
locked: true,
|
||||
lockReason: "voice_message",
|
||||
privateMessageHint: "A voice message is waiting.",
|
||||
@@ -759,6 +759,7 @@ describe("chatMachine transitions", () => {
|
||||
messageId: "msg-voice-locked",
|
||||
response: makeUnlockPrivateResponse({
|
||||
content: "This response content must be ignored.",
|
||||
audioUrl: "https://example.com/unlocked-voice.mp3",
|
||||
}),
|
||||
},
|
||||
}),
|
||||
@@ -783,7 +784,7 @@ describe("chatMachine transitions", () => {
|
||||
{
|
||||
id: "msg-voice-locked",
|
||||
content: "Original voice transcript.",
|
||||
audioUrl: "https://example.com/voice.mp3",
|
||||
audioUrl: "https://example.com/unlocked-voice.mp3",
|
||||
locked: false,
|
||||
lockReason: null,
|
||||
privateMessageHint: null,
|
||||
@@ -802,7 +803,6 @@ describe("chatMachine transitions", () => {
|
||||
content: "",
|
||||
isFromAI: true,
|
||||
date: "2026-06-29",
|
||||
audioUrl: "https://example.com/voice.mp3",
|
||||
locked: true,
|
||||
lockReason: "voice_message",
|
||||
privateMessageHint: "A voice message is waiting.",
|
||||
@@ -855,6 +855,14 @@ describe("chatMachine transitions", () => {
|
||||
requiredCredits: 10,
|
||||
shortfallCredits: 7,
|
||||
});
|
||||
expect(actor.getSnapshot().context.messages).toMatchObject([
|
||||
{
|
||||
id: "msg-voice-locked",
|
||||
locked: true,
|
||||
lockReason: "voice_message",
|
||||
},
|
||||
]);
|
||||
expect(actor.getSnapshot().context.messages[0]?.audioUrl).toBeUndefined();
|
||||
expect(actor.getSnapshot().context.isUnlockingMessage).toBe(false);
|
||||
|
||||
actor.stop();
|
||||
|
||||
Reference in New Issue
Block a user