DigitalConsumer.FixMyGlass/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.spec.js
2023-11-13 13:17:18 +05:30

40 lines
1 KiB
JavaScript

import { shallowMount } from "@vue/test-utils";
import promoQuestion from "./promo-question";
describe("promo-question.vue", () => {
it("Should get the modelValue", async () => {
// Arrange
const text = "test";
const wrapper = shallowMount(promoQuestion, {
props: {
modelValue: text,
},
attachTo: document.body,
});
// Act
const modelValueText = wrapper.vm.value;
wrapper.vm.value = "test also";
// Assert
expect(modelValueText).toEqual("test");
});
it("Should emit to set value", async () => {
// Arrange
const text = "test";
const wrapper = shallowMount(promoQuestion, {
props: {
modelValue: text,
},
attachTo: document.body,
});
// Act
const modelValueText = wrapper.vm.value;
wrapper.vm.value = "test also";
// Assert
expect(wrapper.emitted("update:modelValue")).toEqual([["test also"]]);
});
});