28 lines
691 B
JavaScript
28 lines
691 B
JavaScript
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
|
import { createWrapper } from 'app/test/vitest/helper';
|
|
import VnDiscount from 'components/common/vnDiscount.vue';
|
|
|
|
describe('VnDiscount', () => {
|
|
let vm;
|
|
|
|
beforeAll(() => {
|
|
vm = createWrapper(VnDiscount, {
|
|
props: {
|
|
data: {},
|
|
price: 100,
|
|
quantity: 2,
|
|
discount: 10,
|
|
}
|
|
}).vm;
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
describe('total', () => {
|
|
it('should calculate total correctly', () => {
|
|
expect(vm.total).toBe(180);
|
|
});
|
|
});
|
|
}); |