Reorder jest mock and import statements for email mocking

This commit is contained in:
Rory Powell 2022-01-31 21:05:14 +00:00
parent 31f0400df5
commit d1bcf4f3ba
5 changed files with 25 additions and 787 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,9 @@
jest.mock("nodemailer")
const setup = require("./utilities")
const sendMailMock = setup.emailMock()
const TENANT_ID = "default"
jest.mock("nodemailer")
const sendMailMock = setup.emailMock()
describe("/api/global/auth", () => {
let request = setup.getRequest()
let config = setup.getConfig()

View File

@ -1,11 +1,7 @@
const setup = require("./utilities")
// mock the email system
jest.mock("nodemailer")
const nodemailer = require("nodemailer")
nodemailer.createTransport.mockReturnValue({
verify: jest.fn(),
})
const setup = require("./utilities")
setup.emailMock()
describe("/api/global/configs/checklist", () => {
let request = setup.getRequest()

View File

@ -1,16 +1,10 @@
jest.mock("nodemailer")
const setup = require("./utilities")
const sendMailMock = setup.emailMock()
const { EmailTemplatePurpose } = require("../../../constants")
const { TENANT_ID } = require("./utilities/structures")
// mock the email system
const sendMailMock = jest.fn()
jest.mock("nodemailer")
const nodemailer = require("nodemailer")
nodemailer.createTransport.mockReturnValue({
sendMail: sendMailMock,
verify: jest.fn(),
})
describe("/api/global/email", () => {
let request = setup.getRequest()
let config = setup.getConfig()

View File

@ -1,7 +1,5 @@
const setup = require("./utilities")
const { TENANT_ID } = require("./utilities/structures")
jest.mock("nodemailer")
const setup = require("./utilities")
const sendMailMock = setup.emailMock()
describe("/api/global/users", () => {