test(Coupon): add test cases (#8231)

This commit is contained in:
nemo-shen
2021-02-27 20:32:48 +08:00
committed by GitHub
parent 4d51c1524a
commit 0cd9052a6f
7 changed files with 666 additions and 342 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import { RED } from '../utils/constant';
import Checkbox from '../checkbox';
export type CouponInfo = {
id: string;
id: string | number;
name: string;
endAt: number;
value: number;
+27
View File
@@ -0,0 +1,27 @@
import { mount } from '../../../test';
import Coupon from '..';
const coupon = {
id: 1,
name: 'name',
discount: 0,
denominations: 150,
originCondition: 0,
reason: '',
value: 150,
valueDesc: '1.5',
description: 'description',
startAt: 1489104000,
endAt: 1514592000,
};
test('should render "van-coupon--disabled" class when using disabled prop', () => {
const wrapper = mount(Coupon, {
props: {
coupon,
disabled: true,
},
});
expect(wrapper.classes()).toContain('van-coupon--disabled');
});