хочу замокать actionsetTaskItemPin
чтобы сделать тест
let dispatch = jest.fn();
test('TaskItemContainer actionsetTaskItemPin', () => {
let actionsetTaskItemPin = jest.fn();
instance.setPin();
expect(actionsetTaskItemPin).toHaveBeenCalledWith({ pin: true, keychapter: props.keychapter, keyitem: props.keyitem },dispatch );
});
setPin = (ifo) => {
let pin = true;
let data = { pin: pin, keychapter: this.state.keychapter, keyitem: this.state.keyitem };
actionsetTaskItemPin(data, this.props.dispatch);
}
вот так не сработало тоже
TaskItemContainer › TaskItemContainer actionsetTaskItemPin
expect(jest.fn()).toHaveBeenCalled()
Expected number of calls: >= 1
Received number of calls: 0
test('TaskItemContainer actionsetTaskItemPin, () => {
instance.setPin();
expect(actionsetTaskItemPin).toHaveBeenCalled();
});