feat(external-entry): define Facebook business links

This commit is contained in:
Codex
2026-07-28 14:53:58 +08:00
parent dae04f75dc
commit fbcd5abe22
4 changed files with 336 additions and 121 deletions
@@ -38,6 +38,21 @@ describe("checkout external browser destination", () => {
});
});
const facebookBusinessEntryCases = [
["private-space", "elio", "chat", null, null, getCharacterRoutes("elio").chat, null],
["private-space", "maya", "chat", null, null, getCharacterRoutes("maya").chat, null],
["private-space", "nayeli", "chat", null, null, getCharacterRoutes("nayeli").chat, null],
["voice", "elio", "chat", "promotion", "voice", getCharacterRoutes("elio").chat, "voice"],
["voice", "maya", "chat", "promotion", "voice", getCharacterRoutes("maya").chat, "voice"],
["voice", "nayeli", "chat", "promotion", "voice", getCharacterRoutes("nayeli").chat, "voice"],
["image-pack", "elio", "private-zone", null, null, getCharacterRoutes("elio").privateZone, null],
["image-pack", "maya", "private-zone", null, null, getCharacterRoutes("maya").privateZone, null],
["image-pack", "nayeli", "private-zone", null, null, getCharacterRoutes("nayeli").privateZone, null],
["coffee", "elio", "tip", null, null, getCharacterRoutes("elio").tip, null],
["coffee", "maya", "tip", null, null, getCharacterRoutes("maya").tip, null],
["coffee", "nayeli", "tip", null, null, getCharacterRoutes("nayeli").tip, null],
] as const;
describe("external entry navigation", () => {
it("defaults to chat", () => {
expect(resolveExternalEntryTarget({})).toBe(ROUTES.chat);
@@ -91,6 +106,26 @@ describe("external entry navigation", () => {
).toBe(getCharacterRoutes("elio").privateZone);
});
it.each(facebookBusinessEntryCases)(
"routes Facebook business entry %s for %s",
(
_entry,
character,
target,
mode,
promotionType,
expectedDestination,
expectedPromotionType,
) => {
expect(resolveExternalEntryDestination({ target, character })).toBe(
expectedDestination,
);
expect(
resolveExternalEntryPromotionType({ mode, promotionType }),
).toBe(expectedPromotionType);
},
);
it.each([
["chat", "elio", getCharacterRoutes("elio").chat],
["chat", "maya", getCharacterRoutes("maya").chat],