mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-08-17 21:25:52 +02:00
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { sendTenantAdminInviteEmail } from "../email-service";
|
|
|
|
describe("sendTenantAdminInviteEmail", () => {
|
|
const mockTenant = {
|
|
id: "test-tenant-id",
|
|
shortName: "testcorp",
|
|
longName: "Test Corporation GmbH",
|
|
descriptions: { en: "A test corporation" },
|
|
languages: ["en"],
|
|
defaultLanguage: "en",
|
|
databaseUrl: "postgresql://test",
|
|
setupState: "NEW" as const,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
logo: null,
|
|
links: {
|
|
website: "https://testcorp.com",
|
|
imprint: "https://testcorp.com/imprint",
|
|
privacyStatement: "https://testcorp.com/privacy",
|
|
},
|
|
};
|
|
|
|
it("should accept correct parameters and not throw for German language", () => {
|
|
const adminEmail = "admin@testcorp.com";
|
|
const adminName = "Test Admin";
|
|
const registrationUrl = "http://localhost:5173/register?tenant=test";
|
|
|
|
// This test just ensures the function accepts the right parameters
|
|
// and doesn't throw on setup (actual email sending will fail without SMTP config)
|
|
expect(() => {
|
|
sendTenantAdminInviteEmail(adminEmail, adminName, mockTenant, registrationUrl, "de");
|
|
}).not.toThrow();
|
|
});
|
|
|
|
it("should accept correct parameters and not throw for English language", () => {
|
|
const adminEmail = "admin@testcorp.com";
|
|
const adminName = "Test Admin";
|
|
const registrationUrl = "http://localhost:5173/register?tenant=test";
|
|
|
|
expect(() => {
|
|
sendTenantAdminInviteEmail(adminEmail, adminName, mockTenant, registrationUrl, "en");
|
|
}).not.toThrow();
|
|
});
|
|
|
|
it("should accept correct parameters and not throw with default language", () => {
|
|
const adminEmail = "admin@testcorp.com";
|
|
const adminName = "Test Admin";
|
|
const registrationUrl = "http://localhost:5173/register?tenant=test";
|
|
|
|
expect(() => {
|
|
sendTenantAdminInviteEmail(adminEmail, adminName, mockTenant, registrationUrl);
|
|
}).not.toThrow();
|
|
});
|
|
});
|