Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { describe, it, vi, expect } from 'vitest';
|
||||
import emailTemplates from "./emailTemplates.server";
|
||||
import { EmailTemplate } from "../dtos/email/EmailTemplate";
|
||||
import fs from "fs";
|
||||
|
||||
const mockEmailTemplates: EmailTemplate[] = [
|
||||
{
|
||||
type: "standard",
|
||||
name: "template-1",
|
||||
alias: "template-1-alias",
|
||||
subject: "template-1-subject",
|
||||
htmlBody: "<p>template-1-body</p>",
|
||||
active: false,
|
||||
associatedServerId: -1,
|
||||
templateId: -1,
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
// Mock fs
|
||||
fs.readdirSync = vi.fn().mockReturnValueOnce(["template-1.md", ]);
|
||||
fs.readFileSync = vi.fn().mockReturnValueOnce(`
|
||||
alias: \`template-1-alias\`
|
||||
|
||||
subject: \`template-1-subject\`
|
||||
|
||||
body: \`<p>template-1-body</p>\`
|
||||
`)
|
||||
|
||||
describe("emailTemplates", () => {
|
||||
it("should return an array of email templates", async () => {
|
||||
const result = await emailTemplates();
|
||||
expect(result).toEqual(mockEmailTemplates);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user