Reorganize repo structure and standards references

This commit is contained in:
david committed 2026-06-29 05:03:42 +02:00
1 parent 3cb93a81be
commit be2054274d
5885 files changed
+2588 -195

No files matched your search

@@ -0,0 +1,53 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("~/utils/db/appConfiguration.db.server", () => ({
getAppConfiguration: vi.fn(),
}));
vi.mock("./MailjetEmailService", () => ({
sendEmailMailjet: vi.fn(async () => ({ provider: "queue", status: "queued", messageId: "job_1" })),
}));
import { getAppConfiguration } from "~/utils/db/appConfiguration.db.server";
import { sendEmailMailjet } from "./MailjetEmailService";
import { sendEmail } from "./EmailService";
const getAppConfigurationMock = vi.mocked(getAppConfiguration);
const sendEmailMailjetMock = vi.mocked(sendEmailMailjet);
describe("EmailService queued delivery", () => {
beforeEach(() => {
vi.clearAllMocks();
delete process.env.MAILJET_API_KEY;
delete process.env.MAILJET_FROM_EMAIL;
getAppConfigurationMock.mockResolvedValue({
email: {
provider: "mailjet",
fromEmail: "",
fromName: "",
supportEmail: "",
},
} as Awaited<ReturnType<typeof getAppConfiguration>>);
});
it("queues mail without requiring Mailjet credentials in the web runtime", async () => {
await sendEmail({
request: new Request("https://admin.example.com/settings/transactional-emails"),
to: "ada@example.com",
subject: "Welcome",
body: "<p>Hello</p>",
alias: "registration-welcome",
data: { firstName: "Ada" },
});
expect(sendEmailMailjetMock).toHaveBeenCalledWith({
data: {
to: "ada@example.com",
subject: "Welcome",
body: "<p>Hello</p>",
alias: "registration-welcome",
data: { firstName: "Ada" },
},
});
});
});