|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { getEmailFooter } from "../getEmailFooter"; |
| 3 | + |
| 4 | +describe("getEmailFooter", () => { |
| 5 | + it("includes reply note in all cases", () => { |
| 6 | + const footer = getEmailFooter(); |
| 7 | + expect(footer).toContain("you can reply directly to this email"); |
| 8 | + }); |
| 9 | + |
| 10 | + it("includes horizontal rule", () => { |
| 11 | + const footer = getEmailFooter(); |
| 12 | + expect(footer).toContain("<hr"); |
| 13 | + }); |
| 14 | + |
| 15 | + it("excludes chat link when roomId is not provided", () => { |
| 16 | + const footer = getEmailFooter(); |
| 17 | + expect(footer).not.toContain("chat.recoupable.com"); |
| 18 | + expect(footer).not.toContain("Or continue the conversation"); |
| 19 | + }); |
| 20 | + |
| 21 | + it("includes chat link when roomId is provided", () => { |
| 22 | + const roomId = "test-room-123"; |
| 23 | + const footer = getEmailFooter(roomId); |
| 24 | + expect(footer).toContain(`https://chat.recoupable.com/chat/${roomId}`); |
| 25 | + expect(footer).toContain("Or continue the conversation on Recoup"); |
| 26 | + }); |
| 27 | + |
| 28 | + it("generates proper HTML with roomId", () => { |
| 29 | + const roomId = "my-room-id"; |
| 30 | + const footer = getEmailFooter(roomId); |
| 31 | + expect(footer).toContain(`href="https://chat.recoupable.com/chat/${roomId}"`); |
| 32 | + expect(footer).toContain('target="_blank"'); |
| 33 | + expect(footer).toContain('rel="noopener noreferrer"'); |
| 34 | + }); |
| 35 | + |
| 36 | + it("applies proper styling", () => { |
| 37 | + const footer = getEmailFooter("room-id"); |
| 38 | + expect(footer).toContain("font-size:12px"); |
| 39 | + expect(footer).toContain("color:#6b7280"); |
| 40 | + }); |
| 41 | +}); |
0 commit comments