Open chanelnumberseven opened 3 years ago
index.test.tsx:
it('delete', async () => { const onDel = jest.fn(); const wrapper = mount( <Component onDel={onDel} />, ); const modal = wrapper.find(Modal); await modal.invoke('onOk')().then(()=>{ expect(onDel.mock.calls).toHaveLength(1); }); }); });
the onOk prop look like:
onOk={async () => { await form.validateFields(['target']).then(() => { onDel(); setVisible.setFalse(); }); }}
get warning:
it work well when onOk look like(just move the state change outside the promise) :
onOk={async () => { setVisible.setFalse(); await form.validateFields(['target']).then(() => { onDel(); }); }}
index.test.tsx:
the onOk prop look like:
get warning:
it work well when onOk look like(just move the state change outside the promise) :