From 3346b96f18f555b2bc7d1bc2cc4cec19cdc3c2e0 Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Fri, 10 Feb 2023 17:09:11 -0300 Subject: [PATCH] Fix test cases and improve test from custom modal --- .../{ => CustomModal}/CustomModal.vue | 0 .../CustomModal/__tests__/CustomModal.spec.ts | 27 ++++++++++++++++ src/components/QrCodeComponent.vue | 8 ++--- src/views/HomeView.vue | 31 +++++++++---------- 4 files changed, 46 insertions(+), 20 deletions(-) rename src/components/{ => CustomModal}/CustomModal.vue (100%) create mode 100644 src/components/CustomModal/__tests__/CustomModal.spec.ts diff --git a/src/components/CustomModal.vue b/src/components/CustomModal/CustomModal.vue similarity index 100% rename from src/components/CustomModal.vue rename to src/components/CustomModal/CustomModal.vue diff --git a/src/components/CustomModal/__tests__/CustomModal.spec.ts b/src/components/CustomModal/__tests__/CustomModal.spec.ts new file mode 100644 index 0000000..3cb723b --- /dev/null +++ b/src/components/CustomModal/__tests__/CustomModal.spec.ts @@ -0,0 +1,27 @@ +import { mount } from "@vue/test-utils"; +import CustomModal from "../CustomModal.vue"; + +describe("CustomModal test", () => { + test("Test custom modal when receive is redirect modal props as false", () => { + const wrapper = mount(CustomModal, { + props: { + isRedirectModal: false, + }, + }); + + expect(wrapper.html()).toContain("ATENÇÃO!"); + expect(wrapper.html()).toContain("Entendi"); + }); + + test("Test custom modal when receive is redirect modal props as true", () => { + const wrapper = mount(CustomModal, { + props: { + isRedirectModal: true, + }, + }); + + expect(wrapper.html()).toContain("Retomar a última compra?"); + expect(wrapper.html()).toContain("Não"); + expect(wrapper.html()).toContain("Sim"); + }); +}); diff --git a/src/components/QrCodeComponent.vue b/src/components/QrCodeComponent.vue index 7ed347a..3321347 100644 --- a/src/components/QrCodeComponent.vue +++ b/src/components/QrCodeComponent.vue @@ -1,10 +1,10 @@