fix: link approval emails to sign-in
This commit is contained in:
1 parent
60ef5ddab9
commit
c1bd620d91
4 files changed
+38
-3
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { beforeEach, expect, test, vi } from "vitest";
|
||||
|
||||
const { sendMail } = vi.hoisted(() => ({
|
||||
sendMail: vi.fn().mockResolvedValue({ messageId: "message-1" }),
|
||||
}));
|
||||
|
||||
vi.mock("nodemailer", () => ({
|
||||
default: {
|
||||
createTransport: () => ({ sendMail }),
|
||||
},
|
||||
}));
|
||||
|
||||
import { emailService } from "./service";
|
||||
|
||||
beforeEach(() => {
|
||||
sendMail.mockClear();
|
||||
});
|
||||
|
||||
test("links new-album notifications to the existing sign-in page", async () => {
|
||||
await emailService.sendNewAlbumNotification(
|
||||
"redaktion@example.com",
|
||||
"Spieltag 1",
|
||||
);
|
||||
|
||||
expect(sendMail).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
to: "redaktion@example.com",
|
||||
html: expect.stringContaining(
|
||||
'href="http://localhost:3000/anmelden"',
|
||||
),
|
||||
}),
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user