Учитывая приведенное ниже, как мне убедиться, что внутренняя функция foo
вызывается с правильным сообщением при выполнении функции bar
?Спасибо.
const foo = (message) => console.log(message);
const bar = () => foo('this is a message');
test('test that the foo function is called with the correct message when the bar' +
' function is executed', () => {
bar();
expect(foo).toHaveBeenCalledWith('this is a message');
});