Files
at-mintel/packages/mail/src/templates/AnalyticsTemplate.test.tsx
Marc Mintel 24625c20f2
Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧹 Lint (push) Failing after 1m23s
Monorepo Pipeline / 🧪 Test (push) Successful in 41s
Monorepo Pipeline / 🏗️ Build (push) Successful in 2m20s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
🏥 Server Maintenance / 🧹 Prune & Clean (push) Failing after 6s
Analytics Mailer / 📊 Send Analytics Reports (push) Successful in 46s
feat: enhance analytics mailer with umami entry/exit pages and beginner-friendly UI
2026-07-27 10:43:44 +02:00

42 lines
1.4 KiB
TypeScript

import { render } from "@react-email/components";
import { describe, it, expect } from "vitest";
import { AnalyticsTemplate, PeriodData } from "./AnalyticsTemplate";
import * as React from "react";
describe("AnalyticsTemplate", () => {
it("renders entry and exit pages correctly", async () => {
const period: PeriodData = {
label: "Test Period",
visitors: 100,
visits: 120,
views: 500,
bounceRate: 50,
visitDuration: "2m",
topPages: [{ url: "/home", views: 50 }],
topReferrers: [{ url: "google.com", visitors: 30 }],
// These fields will cause a TS error because they don't exist yet,
// but we force it to see it fail.
topEntryPages: [{ url: "/entry", visitors: 40 }],
topExitPages: [{ url: "/exit", visitors: 20 }],
chartData: [],
} as any; // Cast as any to bypass TS compilation before we update the type
const html = await render(
<AnalyticsTemplate
greeting="Hallo Kunde,"
domain="example.com"
periods={[period]}
/>
);
// Assert that the new sections for entry and exit pages exist.
expect(html).toContain("Häufigste Einstiege");
expect(html).toContain("Häufigste Ausstiege");
expect(html).toContain("/entry");
expect(html).toContain("/exit");
// Assert that the badges have updated line heights
expect(html).toContain('line-height:1.5');
});
});