pref: spy on clearInterval for Upload & check actions for Card

This commit is contained in:
zy410419243 2019-03-18 15:06:06 +08:00
parent 337e0285ec
commit 2ee56a9c4a
2 changed files with 10 additions and 1 deletions

View File

@ -104,4 +104,13 @@ describe('Card', () => {
const wrapper = mount(<Card noHovering={false}>xxx</Card>);
expect(wrapper.find('.ant-card-hoverable').length).toBe(1);
});
it('should not render when actions is number', () => {
const wrapper = mount(
<Card title="Card title" actions={11}>
<p>Card content</p>
</Card>,
);
expect(wrapper.find('.ant-card-actions').length).toBe(0);
});
});

View File

@ -377,7 +377,7 @@ describe('Upload', () => {
<button type="button">upload</button>
</Upload>,
);
const unmountSpy = jest.spyOn(wrapper.instance(), 'componentWillUnmount');
const unmountSpy = jest.spyOn(global, 'clearInterval');
wrapper.unmount();
expect(unmountSpy).toHaveBeenCalled();
});