This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously. closes #1282
26 lines
942 B
TypeScript
26 lines
942 B
TypeScript
import mailer from "./mailer";
|
|
|
|
describe("Mailer", () => {
|
|
const fakeMailer = mailer;
|
|
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'sendMailOutput' implicitly has type 'any... Remove this comment to see the full error message
|
|
let sendMailOutput;
|
|
beforeEach(() => {
|
|
process.env.URL = "http://localhost:3000";
|
|
process.env.SMTP_FROM_EMAIL = "hello@example.com";
|
|
jest.resetModules();
|
|
fakeMailer.transporter = {
|
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'output' implicitly has an 'any' type.
|
|
sendMail: (output) => (sendMailOutput = output),
|
|
};
|
|
});
|
|
|
|
test("#welcome", () => {
|
|
fakeMailer.welcome({
|
|
to: "user@example.com",
|
|
teamUrl: "http://example.com",
|
|
});
|
|
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'sendMailOutput' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
expect(sendMailOutput).toMatchSnapshot();
|
|
});
|
|
});
|