Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jest mock instance

test("mock.instances", () => {
  const mockFn = jest.fn();

  const a = new mockFn();
  const b = new mockFn();

  mockFn.mock.instances[0] === a;
  mockFn.mock.instances[1] === b;
});
Source by jestjs.io #
 
PREVIOUS NEXT
Tagged: #jest #mock #instance
ADD COMMENT
Topic
Name
1+3 =