Quiz Yourself on Mocking

This quiz will test what you have learned in this chapter.

1

(Select all that apply.) What expectations pass after the following code is executed?

const mock = jest.fn();
mock(1);
mock(2);
A)
expect(mock).toBeCalled();
B)
expect(mock).toBeCalledTimes(1);
C)
expect(mock).toBeCalledTimes(2);
D)
expect(mock).toBeCalledWith(1);
E)
expect(mock).toBeCalledWith(2);
Question 1 of 80 attempted

Get hands-on with 1200+ tech skills courses.