forked from verdnatura/salix-front
Merge pull request 'feat: refs #7072 added test to computed fn total' (!1078) from 7072-createVnDiscountSpec into dev
Reviewed-on: verdnatura/salix-front#1078 Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
228100853c
|
@ -0,0 +1,28 @@
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue