From aa47c33e69f41af8c0759c3a354145eab23fd93b Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 6 Oct 2023 09:38:22 -0400 Subject: [PATCH] Updated unit tests --- jest.config.js | 2 +- .../classes/provider-address.js | 15 ++++++++++++ .../service-location/classes/provider.js | 8 +++++++ .../service-location-helper.js | 23 ------------------- .../service-location/service-location.spec.js | 10 +++++++- .../service-location/service-location.vue | 4 +++- .../shop-question/shop-question.vue | 7 +++--- 7 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 src/layouts/service-location/classes/provider-address.js create mode 100644 src/layouts/service-location/classes/provider.js diff --git a/jest.config.js b/jest.config.js index 93249f226..0f45a8a97 100644 --- a/jest.config.js +++ b/jest.config.js @@ -31,5 +31,5 @@ module.exports = { }, }, // Uncomment this to avoid the massive amount of warnings we are getting for onSubmit and onInvalidSubmit - // silent: true, + silent: true, }; diff --git a/src/layouts/service-location/classes/provider-address.js b/src/layouts/service-location/classes/provider-address.js new file mode 100644 index 000000000..52f24109a --- /dev/null +++ b/src/layouts/service-location/classes/provider-address.js @@ -0,0 +1,15 @@ +export class ProviderAddress { + constructor( + streetAddress = null, + city = null, + state = null, + zipCode = null, + zipCodeCtu = null + ) { + this.streetAddress = streetAddress; + this.city = city; + this.state = state; + this.zipCode = zipCode; + this.zipCodeCtu = zipCodeCtu; + } +} diff --git a/src/layouts/service-location/classes/provider.js b/src/layouts/service-location/classes/provider.js new file mode 100644 index 000000000..dd9c7cd8c --- /dev/null +++ b/src/layouts/service-location/classes/provider.js @@ -0,0 +1,8 @@ +import { ProviderAddress } from "./provider-address"; + +export class Provider { + constructor(providerNumber = null, address = null) { + this.providerNumber = providerNumber; + this.address = address ?? new ProviderAddress(); + } +} 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 9ac30b976..cb4c06100 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 @@ -74,26 +74,3 @@ export async function getAvailabilityRating( return Promise.resolve(shopStatus); } - -export class Provider { - constructor(providerNumber = null, address = null) { - this.providerNumber = providerNumber; - this.address = address ?? new ProviderAddress(); - } -} - -export class ProviderAddress { - constructor( - streetAddress = null, - city = null, - state = null, - zipCode = null, - zipCodeCtu = null - ) { - this.streetAddress = streetAddress; - this.city = city; - this.state = state; - this.zipCode = zipCode; - this.zipCodeCtu = zipCodeCtu; - } -} diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 0073a9f65..6cd3bc2f1 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -7,7 +7,10 @@ import { getMountOptions } from "@/helpers/unit-test-helper"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; -import { getServiceabilityDetails } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { + getServiceabilityDetails, + Provider, +} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; // Define Mocks jest.mock("@/helpers/cms-content-helper", () => ({ @@ -16,6 +19,8 @@ jest.mock("@/helpers/cms-content-helper", () => ({ }), })); +jest.mock("./classes/provider"); + const mockGetPricedMobileFeePart = (mockServiceZipCode) => { let mobileFeePart = {}; @@ -397,6 +402,7 @@ describe("service-location.vue", () => { await wrapper.setData({ selectedAppointmentType: "Mobile", + providerData: { mobileProviderNumber: "01820" }, }); const mobileLocationQuestionsComponent = wrapper.findComponent({ @@ -448,6 +454,7 @@ describe("service-location.vue", () => { await wrapper.setData({ selectedAppointmentType: "Mobile", + providerData: { mobileProviderNumber: "01820" }, }); const mobileLocationQuestionsComponent = wrapper.findComponent({ @@ -511,6 +518,7 @@ describe("service-location.vue", () => { await wrapper.setData({ selectedAppointmentType: "Mobile", + providerData: { mobileProviderNumber: "01820" }, }); const mobileLocationQuestionsComponent = wrapper.findComponent({ diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index d03adaaa7..3e8587a7a 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -135,8 +135,10 @@ import { settleAllPromises } from "@/helpers/layout-helper"; import { getPricedMobileFeePart, getServiceabilityDetails, - Provider, } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; + +import { Provider } from "@/layouts/service-location/classes/provider"; + import store from "@/store"; // Validation diff --git a/src/layouts/service-location/shop-question/shop-question.vue b/src/layouts/service-location/shop-question/shop-question.vue index 9950b03f9..c3f31c68d 100644 --- a/src/layouts/service-location/shop-question/shop-question.vue +++ b/src/layouts/service-location/shop-question/shop-question.vue @@ -52,10 +52,9 @@ import { errorMessages } from "@/constants/error-messages"; import baseMixin from "@/mixins/base-mixin.js"; import { nextTick } from "vue"; -import { - getAvailabilityRating, - Provider, -} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { getAvailabilityRating } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; + +import { Provider } from "@/layouts/service-location/classes/provider"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED));