From 99faf4d0679ffef06f39b44e5c2eed121b04efe7 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Thu, 9 Mar 2023 13:55:42 -0500 Subject: [PATCH] Prettified --- .../service-location-helper.js | 9 +++++-- .../service-location-helper.spec.js | 26 +++++++++++++------ .../mobile-location-modal-questions.vue | 4 +-- .../service-location/service-location.spec.js | 17 +++++++----- .../service-location/service-location.vue | 14 ++++++++-- 5 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index a1aeb4b7b..f9529ccec 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -1,7 +1,12 @@ import { storeActions } from "@/constants/store-actions"; import baseMixin from "@/mixins/base-mixin.js"; -export async function getPricedMobileFeePart(serviceZipCode, serviceType, parentAccountNumber, billToAccountNumber) { +export async function getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber +) { if (!serviceZipCode || !serviceType || !parentAccountNumber) { return Promise.resolve(null); } @@ -14,7 +19,7 @@ export async function getPricedMobileFeePart(serviceZipCode, serviceType, parent { serviceType: serviceType, parentAccountNumber: parentAccountNumber, - billToAccountNumber: billToAccountNumber + billToAccountNumber: billToAccountNumber, }, false ); diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js index bb841e327..061fd6bcd 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js @@ -48,13 +48,18 @@ describe("service-location-helper.js", () => { it("Should return null if no service zip code is passed in", async () => { // Arrange const serviceZipCode = null; - const serviceType = "Replace"; - const parentAccountNumber = 167132 - const billToAccountNumber = 1234 + const serviceType = "Replace"; + const parentAccountNumber = 167132; + const billToAccountNumber = 1234; const expected = null; // Act - const result = await getPricedMobileFeePart(serviceZipCode, serviceType, parentAccountNumber, billToAccountNumber); + const result = await getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber + ); // Assert expect(result).toEqual(expected); @@ -63,9 +68,9 @@ describe("service-location-helper.js", () => { it("Should return the priced mobile fee part", async () => { // Arrange const serviceZipCode = "43235"; - const serviceType = "Replace"; - const parentAccountNumber = 167132 - const billToAccountNumber = 1234 + const serviceType = "Replace"; + const parentAccountNumber = 167132; + const billToAccountNumber = 1234; const expected = { partNumber: "MOBILE FEE", @@ -77,7 +82,12 @@ describe("service-location-helper.js", () => { }; // Act - const result = await getPricedMobileFeePart(serviceZipCode, serviceType, parentAccountNumber, billToAccountNumber); + const result = await getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber + ); // Assert expect(result).toEqual(expected); diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 5063dc432..e2f3d3458 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -187,8 +187,8 @@ export default { this.resetComponent({ state: newValue.state, - zipCode: newValue.zipCode - }) + zipCode: newValue.zipCode, + }); }, deep: true, }, diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index b163f7592..fbe7aa448 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -32,11 +32,14 @@ const mockGetPricedMobileFeePart = (mockServiceZipCode) => { return Promise.resolve(mobileFeePart); }; -jest.mock("@/layouts/service-location/helpers/service-location-helper/service-location-helper", () => ({ - getPricedMobileFeePart: jest.fn((mockServiceZipCode) => { - return mockGetPricedMobileFeePart(mockServiceZipCode); - }), -})); +jest.mock( + "@/layouts/service-location/helpers/service-location-helper/service-location-helper", + () => ({ + getPricedMobileFeePart: jest.fn((mockServiceZipCode) => { + return mockGetPricedMobileFeePart(mockServiceZipCode); + }), + }) +); jest.mock("@/store", () => ({ commit: jest.fn(), @@ -134,7 +137,7 @@ beforeEach(() => { }, }, damage: { - isRepair: false + isRepair: false, }, payment: { isInsurance: false, @@ -224,7 +227,7 @@ describe("service-location.vue", () => { test("updates the page model after providing the service zip code", () => { // Arrange const { wrapper } = setupMocks({ - mixins: [mockMixin] + mixins: [mockMixin], }); wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn(); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 00017db80..c4944f3ee 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -64,7 +64,12 @@ export default { const parentAccountNumber = store.getters.payment.parentAccountNumber; const billToAccountNumber = 0; - const mobileFeePartPromise = getPricedMobileFeePart(serviceZipCode, serviceType, parentAccountNumber, billToAccountNumber); + const mobileFeePartPromise = getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber + ); // Settle promises and get results const promiseResultMap = [ @@ -157,7 +162,12 @@ export default { const parentAccountNumber = store.getters.payment.parentAccountNumber; const billToAccountNumber = 0; - getPricedMobileFeePart(serviceZipCode, serviceType, parentAccountNumber, billToAccountNumber).then((pricedMobileFeePart) => { + getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber + ).then((pricedMobileFeePart) => { this.mobileFeePart = pricedMobileFeePart; }); },