diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js
index 4757c6a78..b0a06b16f 100644
--- a/src/layouts/service-location/service-location.spec.js
+++ b/src/layouts/service-location/service-location.spec.js
@@ -545,7 +545,7 @@ describe("service-location.vue", () => {
expect(wrapper.vm.isServiceableInshop).toEqual(false);
});
- test("isServiceableMobileOnly should be true if mobile is true and inshop is false.", async () => {
+ test("displayServiceableMobileOnly should be true if mobile is true and inshop is false.", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -569,10 +569,10 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(true);
expect(wrapper.vm.isServiceableInshop).toEqual(false);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(true);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(true);
});
- test("isServiceableMobileOnly should be false if mobile is false.", async () => {
+ test("displayServiceableMobileOnly should be false if mobile is false.", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -596,10 +596,10 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(false);
expect(wrapper.vm.isServiceableInshop).toEqual(false);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(false);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(false);
});
- test("isServiceableMobileOnly should be false if inShop is true", async () => {
+ test("displayServiceableMobileOnly should be false if inShop is true", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -623,7 +623,115 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(true);
expect(wrapper.vm.isServiceableInshop).toEqual(true);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(false);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(false);
+ });
+
+ test("displayNoShopsAlert should be true if inShop is false and mobile is false", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: false,
+ isRecalibrationServiceableInshop: false,
+ isGlassServiceableMobile: false,
+ isRecalibrationServiceableMobile: false,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(wrapper.vm.isServiceableMobile).toEqual(false);
+ expect(wrapper.vm.isServiceableInshop).toEqual(false);
+ expect(wrapper.vm.displayNoShopsAlert).toEqual(true);
+ });
+
+ test("displayNoShopsAlert should be false if inShop is true and mobile is true", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: true,
+ isRecalibrationServiceableInshop: true,
+ isGlassServiceableMobile: true,
+ isRecalibrationServiceableMobile: true,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(wrapper.vm.isServiceableMobile).toEqual(true);
+ expect(wrapper.vm.isServiceableInshop).toEqual(true);
+ expect(wrapper.vm.displayNoShopsAlert).toEqual(false);
+ });
+
+ test("displayNoShopsAlert should be false if inShop is true", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: true,
+ isRecalibrationServiceableInshop: true,
+ isGlassServiceableMobile: false,
+ isRecalibrationServiceableMobile: false,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(wrapper.vm.isServiceableMobile).toEqual(false);
+ expect(wrapper.vm.isServiceableInshop).toEqual(true);
+ expect(wrapper.vm.displayNoShopsAlert).toEqual(false);
+ });
+
+ test("displayNoShopsAlert should be false if mobile is true", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: false,
+ isRecalibrationServiceableInshop: false,
+ isGlassServiceableMobile: true,
+ isRecalibrationServiceableMobile: true,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(wrapper.vm.isServiceableMobile).toEqual(true);
+ expect(wrapper.vm.isServiceableInshop).toEqual(false);
+ expect(wrapper.vm.displayNoShopsAlert).toEqual(false);
});
});
@@ -680,7 +788,7 @@ describe("service-location.vue", () => {
expect(wrapper.vm.isServiceableInshop).toEqual(false);
});
- test("isServiceableMobileOnly should be true if mobile is true and inshop is false.", async () => {
+ test("displayServiceableMobileOnly should be true if mobile is true and inshop is false.", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -704,10 +812,10 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(true);
expect(wrapper.vm.isServiceableInshop).toEqual(false);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(true);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(true);
});
- test("isServiceableMobileOnly should be false if mobile is false", async () => {
+ test("displayServiceableMobileOnly should be false if mobile is false", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -731,10 +839,10 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(false);
expect(wrapper.vm.isServiceableInshop).toEqual(false);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(false);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(false);
});
- test("isServiceableMobileOnly should be false if inShop is true", async () => {
+ test("displayServiceableMobileOnly should be false if inShop is true", async () => {
// Arrange
getServiceabilityDetails.mockImplementation(() =>
Promise.resolve({
@@ -758,7 +866,7 @@ describe("service-location.vue", () => {
// Assert
expect(wrapper.vm.isServiceableMobile).toEqual(true);
expect(wrapper.vm.isServiceableInshop).toEqual(true);
- expect(wrapper.vm.isServiceableMobileOnly).toEqual(false);
+ expect(wrapper.vm.displayServiceableMobileOnly).toEqual(false);
});
});
@@ -784,7 +892,7 @@ describe("service-location.vue", () => {
(c) => c(wrapper.vm)
);
- const alertComponent = wrapper.findComponent('[data-test="mobileOnlyAlert"]');
+ const alertComponent = wrapper.findComponent({ ref: "alertMobileOnly" });
// Assert
expect(alertComponent.exists()).toBe(true);
@@ -811,7 +919,61 @@ describe("service-location.vue", () => {
(c) => c(wrapper.vm)
);
- const alertComponent = wrapper.findComponent('[data-test="mobileOnlyAlert"]');
+ const alertComponent = wrapper.findComponent({ ref: "alertMobileOnly" });
+
+ // Assert
+ expect(alertComponent.exists()).toBe(false);
+ });
+
+ test("Should show no-shop error if no shops are available.", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: false,
+ isRecalibrationServiceableInshop: false,
+ isGlassServiceableMobile: false,
+ isRecalibrationServiceableMobile: false,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ const alertComponent = wrapper.findComponent({ ref: "alertNoShops" });
+
+ // Assert
+ expect(alertComponent.exists()).toBe(true);
+ });
+
+ test("Should not show no-shop error if shops are available.", async () => {
+ // Arrange
+ getServiceabilityDetails.mockImplementation(() =>
+ Promise.resolve({
+ isGlassServiceableInshop: true,
+ isRecalibrationServiceableInshop: true,
+ isGlassServiceableMobile: true,
+ isRecalibrationServiceableMobile: true,
+ })
+ );
+
+ const { wrapper } = setupMocks({});
+
+ // Act
+ await serviceLocation.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "serviceLocation" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ const alertComponent = wrapper.findComponent({ ref: "alertNoShops" });
// Assert
expect(alertComponent.exists()).toBe(false);
diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue
index df7c58155..7f8430f04 100644
--- a/src/layouts/service-location/service-location.vue
+++ b/src/layouts/service-location/service-location.vue
@@ -14,20 +14,22 @@
linkWidgetName="ServiceZipLinkWidget"
modalWidgetName="ServiceZipModalWidget" />
+ v-if="displayServiceableMobileOnly"
+ alertClass="alert-warning" />
{
vm.setCmsContent(resultMap.cmsContent);
- console.log(resultMap.serviceabilityDetails);
vm.setData(
resultMap.zipCodeData,
resultMap.serviceabilityDetails,
@@ -216,9 +217,23 @@ export default {
return this.isGlassServiceableInshop;
}
},
- isServiceableMobileOnly() {
+ displayServiceableMobileOnly() {
return this.isServiceableMobile && !this.isServiceableInshop;
},
+ displayNoShopsAlert() {
+ let mobileAvailable;
+ if (this.IsRecalibrationServiceableMobile == null) {
+ mobileAvailable = this.isGlassServiceableMobile;
+ } else {
+ mobileAvailable =
+ this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile;
+ }
+
+ const inshopAvailable =
+ this.isGlassServiceableInshop && this.isRecalibrationServiceableInshop;
+
+ return !inshopAvailable && !mobileAvailable;
+ },
},
methods: {
arePagePrerequisitesValid() {
diff --git a/src/store/index.js b/src/store/index.js
index 77289926b..2dbc7b2cc 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -43,7 +43,7 @@ const getDefaultState = () => {
state: null,
zipCode: null,
zipCodeCtu: null,
- serviceType: null,
+ appointmentType: null,
},
customer: {
emailAddress: null,
@@ -931,10 +931,10 @@ export const actions = {
return globalMethods.callMockHttpClient({
method: endpoints.GetServiceabilityDetails.method,
//TODO: Remove Mocky Endpoints
- //endpoint: "https://run.mocky.io/v3/59e1a644-cf16-4f08-8069-1ab2a1e38f79", // NoShopsAvailable
+ endpoint: "https://run.mocky.io/v3/59e1a644-cf16-4f08-8069-1ab2a1e38f79", // NoShopsAvailable
//endpoint: "https://run.mocky.io/v3/4fe1fb89-dd56-4e4a-9af2-96bd1ab77847", // ForcedInshop
//endpoint: "https://run.mocky.io/v3/e2eaa097-6ea5-4906-af53-901edaa94939", // ForcedMobile
- endpoint: "https://run.mocky.io/v3/1811a1fe-12a7-48f3-939e-d10a9b77dd25", // All Options
+ //endpoint: "https://run.mocky.io/v3/1811a1fe-12a7-48f3-939e-d10a9b77dd25", // All Options
});
// TODO: Restore this when CSR-1104 is 100% complete