当我尝试spyOn ReduxForm.reset时出现错误
import * as ReduxForm from 'redux-form';
...
const resetFormSpy = spyOn(ReduxForm, 'reset');
// Error: <spyOn> : reset is not declared writable or has no setter
...
expect(resetFormSpy).toHaveBeenCalled();
我使用类似的策略(import * as ...
)监视其他导入的函数,并且不确定失败的原因是redux-form
。
真的redux-form
将reset
函数定义为不可写的吗? (我在code base)