我已经尝试了很多但是被卡住了,如何使用内部reducer动作模拟选择器值。 以下未通过
it('updates the store', () => {
console.log(component.debug());
expect(store.dispatch).toHaveBeenCalledWith(setLastPropertyId(properties[properties.length - 1].id));
});
它给了我未定义的属性。
const setLastProperty = () => {
if (!isEmpty(properties)) {
dispatch(setLastPropertyId(properties[properties.length - 1].id));
}
console.log('setLastProperty -> properties', properties);
};
完整的代码是here