javascript how to check function is already called code example Example: check if the method is not called in jest expect(controller.bar).not.toHaveBeenCalled();