refactor: update mocking logger in register test
This commit is contained in:
parent
cb4185b360
commit
e6a324b484
@ -1,6 +1,9 @@
|
|||||||
import { JSDOM } from "jsdom"
|
import { JSDOM } from "jsdom"
|
||||||
import { loggerModule } from "./helpers"
|
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", () => {
|
describe("register", () => {
|
||||||
const { window } = new JSDOM()
|
const { window } = new JSDOM()
|
||||||
global.window = (window as unknown) as Window & typeof globalThis
|
global.window = (window as unknown) as Window & typeof globalThis
|
||||||
@ -18,10 +21,6 @@ describe("register", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.mock("@coder/logger", () => loggerModule)
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
mockRegisterFn.mockClear()
|
mockRegisterFn.mockClear()
|
||||||
jest.resetModules()
|
jest.resetModules()
|
||||||
|
Reference in New Issue
Block a user