feat(payment): add chat support discounts and gratitude
Docker Image / Build and Push Docker Image (push) Successful in 2m14s
Docker Image / Build and Push Docker Image (push) Successful in 2m14s
(cherry picked from commit ef9b79bc83)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { appendCommercialMessage } from "../helper/commercial-message";
|
||||
|
||||
describe("chat commercial message", () => {
|
||||
const incoming = {
|
||||
messageId: "payment-thanks-1",
|
||||
message: "Thank you for supporting me.",
|
||||
characterId: "maya-tan",
|
||||
createdAt: "2026-07-28T08:30:00.000Z",
|
||||
};
|
||||
|
||||
it("appends one persisted payment thank-you to the matching character chat", () => {
|
||||
const messages = appendCommercialMessage([], "maya-tan", incoming);
|
||||
|
||||
expect(messages).toHaveLength(1);
|
||||
expect(messages[0]).toMatchObject({
|
||||
remoteId: "payment-thanks-1",
|
||||
content: "Thank you for supporting me.",
|
||||
isFromAI: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores duplicate delivery and a message for another character", () => {
|
||||
const messages = appendCommercialMessage([], "maya-tan", incoming);
|
||||
|
||||
expect(appendCommercialMessage(messages, "maya-tan", incoming)).toEqual(
|
||||
messages,
|
||||
);
|
||||
expect(appendCommercialMessage(messages, "elio", incoming)).toEqual(
|
||||
messages,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user