0
componentWillMount() {
// redux store
CrudActions.getUsers();
}
如何使用笑話來呼叫我的減速器?我想寫的行爲,而不是調用另一個CrudActions的SETALL功能測試。componentWillMount內的測試功能
到目前爲止,我只能夠調用componentWillMount
test('calls `componentWillMount` before rendering',() => {
const onWillMount = jest.fn();
CrudList.prototype.componentWillMount = onWillMount;
mount(<CrudList />);
expect(onWillMount).toBeCalled();
});