From 8b2b22b86846854765f6a5943e3041cf03516243 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 11 Feb 2025 10:33:52 -0500 Subject: [PATCH] CASH-201 | Add unit test --- src/layouts/quote/quote.spec.js | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index deca0d6d1..522bc4f2e 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -577,6 +577,56 @@ describe("quote.vue", () => { //Assert expect(wrapper.vm.isInsuranceSelected).toBe(false); }); + test("should default to cash if isCashSelected is true, despite all other checks pointing to insurance selection", async () => { + // Also needs no query parameter or previous selection in store to be present + //Arrange + + store.getters = { + lineItems: { + glassParts: ["item", "item2"], + }, + applicationUser: { + experiments: [], + }, + order: { + lineItems: { + glassParts: ["item", "item2"], + }, + payment: { + isInsurance: true, + }, + customer: { + emailAddress: "test@test.com", + }, + serviceLocation: { + state: null, + }, + }, + vehicle: { + cardId: "123", + }, + experimentSettings: { + settingName: "SERVICE_PACKAGE_DISCOUNT", + }, + }; + mockTierOnePrice = 505; + const { wrapper } = setupMocks({}); + + + //Act + await quote.beforeRouteEnter.call( + wrapper.vm, + { query: { fmgPage: "quote", + isInsuranceSelected: true, + isCashSelected: true, + } }, + undefined, + (c) => c(wrapper.vm) + ); + + //Assert + expect(wrapper.vm.isInsuranceSelected).toBe(false); + }); test("should default to insurance if total economy package price is over $500", async () => { // Also needs no query parameter or previous selection in store to be present //Arrange