refactor: update mocking logger in register test

This commit is contained in:
Joe Previte 2021-02-23 16:11:04 -07:00
parent cb4185b360
commit e6a324b484
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -1,6 +1,9 @@
import { JSDOM } from "jsdom"
import { loggerModule } from "./helpers"
// jest.mock is hoisted above the imports so we must use `require` here.
jest.mock("@coder/logger", () => require("./helpers").loggerModule)
describe("register", () => {
const { window } = new JSDOM()
global.window = (window as unknown) as Window & typeof globalThis
@ -18,10 +21,6 @@ describe("register", () => {
})
})
beforeEach(() => {
jest.mock("@coder/logger", () => loggerModule)
})
afterEach(() => {
mockRegisterFn.mockClear()
jest.resetModules()