ignore types for direct mockImpl calls

This commit is contained in:
Martin McKeaveney 2024-11-15 14:41:05 +00:00
parent ddd5a37928
commit 78cf681580
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,7 @@ describe("contentSecurityPolicy middleware", () => {
set: jest.fn(),
}
next = jest.fn()
// @ts-ignore
crypto.randomBytes.mockReturnValue(Buffer.from(mockNonce, "base64"))
})
@ -58,6 +59,7 @@ describe("contentSecurityPolicy middleware", () => {
it("should handle errors and log an error message", async () => {
const consoleSpy = jest.spyOn(console, "error").mockImplementation()
const error = new Error("Test error")
// @ts-ignore
crypto.randomBytes.mockImplementation(() => {
throw error
})