From dae64e0ef4164be9b93607d7a763dd9e955d1598 Mon Sep 17 00:00:00 2001 From: Kroell Date: Wed, 19 Apr 2023 12:28:45 -0400 Subject: [PATCH] unit test for service-zip-question --- .../service-zip-question.spec.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js b/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js new file mode 100644 index 00000000..b3276a7a --- /dev/null +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js @@ -0,0 +1,40 @@ +import { shallowMount } from "@vue/test-utils"; +import serviceZipQuestion from "./service-zip-question"; + +describe("service-zip-question.vue", () => { + it("Should get the modelValue", async () => { + // Arrange + const text = "test"; + const wrapper = shallowMount(serviceZipQuestion, { + 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(serviceZipQuestion, { + 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"]]); + }); +}); \ No newline at end of file