输入Jest单元测试:componentWillUnmount clearTimeoutthistimer;
test('componentWillUnmount should clear the timer', () => {
const wrapper = shallow(
instance.componentWillUnmount();
expect(global.clearTimeout).toHaveBeenCalledWith(instance.timer);
});
原文地址: https://www.cveoy.top/t/topic/hJkW 著作权归作者所有。请勿转载和采集!