V
V
Vladimir Golub2020-03-25 17:57:59
JavaScript
Vladimir Golub, 2020-03-25 17:57:59

How to make a mock function that is imported directly, and not as an object method (JEST)?

A function that is a method of an object is substituted through jest.spyOn.
How to mock a function that is directly imported and can be called directly in the function under test?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Petrov, 2020-03-25
@RazerVG

Through jest.mock . A module is passed that needs to be locked and then some basic implementation of this module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question