Prettifed, Fixed and Updated some unit tests for consistency
This commit is contained in:
parent
ebad5c6fae
commit
6c7b8b98fe
2 changed files with 39 additions and 45 deletions
|
|
@ -7,7 +7,6 @@ import { getMountOptions } from "@/helpers/unit-test-helper";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
import { getServiceabilityDetails } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
|
||||||
|
|
||||||
// Define Mocks
|
// Define Mocks
|
||||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
|
|
@ -412,6 +411,9 @@ describe("service-location.vue", () => {
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
|
shopProviderData: {
|
||||||
|
mobileProviderNumber: "001820",
|
||||||
|
},
|
||||||
selectedAppointmentType: "Mobile",
|
selectedAppointmentType: "Mobile",
|
||||||
providerData: { mobileProviderNumber: "01820" },
|
providerData: { mobileProviderNumber: "01820" },
|
||||||
});
|
});
|
||||||
|
|
@ -464,6 +466,9 @@ describe("service-location.vue", () => {
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
|
shopProviderData: {
|
||||||
|
mobileProviderNumber: "001820",
|
||||||
|
},
|
||||||
selectedAppointmentType: "Mobile",
|
selectedAppointmentType: "Mobile",
|
||||||
providerData: { mobileProviderNumber: "01820" },
|
providerData: { mobileProviderNumber: "01820" },
|
||||||
});
|
});
|
||||||
|
|
@ -528,6 +533,9 @@ describe("service-location.vue", () => {
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
|
shopProviderData: {
|
||||||
|
mobileProviderNumber: "001820",
|
||||||
|
},
|
||||||
selectedAppointmentType: "Mobile",
|
selectedAppointmentType: "Mobile",
|
||||||
providerData: { mobileProviderNumber: "01820" },
|
providerData: { mobileProviderNumber: "01820" },
|
||||||
});
|
});
|
||||||
|
|
@ -984,14 +992,13 @@ describe("service-location.vue", () => {
|
||||||
describe("should be based only on glass serviceability if recalibration is not defined.", () => {
|
describe("should be based only on glass serviceability if recalibration is not defined.", () => {
|
||||||
test("Should return true", async () => {
|
test("Should return true", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1012,14 +1019,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should return false", async () => {
|
test("Should return false", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: false,
|
isGlassServiceableMobile: false,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1040,14 +1046,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("displayServiceableMobileOnly 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
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1069,14 +1074,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("displayServiceableMobileOnly should be false if mobile is false", async () => {
|
test("displayServiceableMobileOnly should be false if mobile is false", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: false,
|
isGlassServiceableMobile: false,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1098,14 +1102,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("displayServiceableMobileOnly should be false if inShop is true", async () => {
|
test("displayServiceableMobileOnly should be false if inShop is true", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1127,14 +1130,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("requiresInshopRecalibration should not be true if recalibration info is null.", async () => {
|
test("requiresInshopRecalibration should not be true if recalibration info is null.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1158,14 +1160,13 @@ describe("service-location.vue", () => {
|
||||||
describe("should properly display alerts.", () => {
|
describe("should properly display alerts.", () => {
|
||||||
test("Should show mobile-only error if only mobile is available.", async () => {
|
test("Should show mobile-only error if only mobile is available.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: false,
|
isRecalibrationServiceableInshop: false,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: true,
|
isRecalibrationServiceableMobile: true,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1187,14 +1188,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should not show mobile-only error if not mobile-only.", async () => {
|
test("Should not show mobile-only error if not mobile-only.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: true,
|
isRecalibrationServiceableInshop: true,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: true,
|
isRecalibrationServiceableMobile: true,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1216,14 +1216,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should show no-shop error if no shops are available.", async () => {
|
test("Should show no-shop error if no shops are available.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: false,
|
isRecalibrationServiceableInshop: false,
|
||||||
isGlassServiceableMobile: false,
|
isGlassServiceableMobile: false,
|
||||||
isRecalibrationServiceableMobile: false,
|
isRecalibrationServiceableMobile: false,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1245,14 +1244,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should not show no-shop error if shops are available.", async () => {
|
test("Should not show no-shop error if shops are available.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: true,
|
isRecalibrationServiceableInshop: true,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: true,
|
isRecalibrationServiceableMobile: true,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1274,14 +1272,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should show inshop-only error if only inshop is available", async () => {
|
test("Should show inshop-only error if only inshop is available", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: true,
|
isRecalibrationServiceableInshop: true,
|
||||||
isGlassServiceableMobile: false,
|
isGlassServiceableMobile: false,
|
||||||
isRecalibrationServiceableMobile: false,
|
isRecalibrationServiceableMobile: false,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1303,14 +1300,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should not show inshop-only error if not inshop-only", async () => {
|
test("Should not show inshop-only error if not inshop-only", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: false,
|
isGlassServiceableInshop: false,
|
||||||
isRecalibrationServiceableInshop: false,
|
isRecalibrationServiceableInshop: false,
|
||||||
isGlassServiceableMobile: false,
|
isGlassServiceableMobile: false,
|
||||||
isRecalibrationServiceableMobile: false,
|
isRecalibrationServiceableMobile: false,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1332,14 +1328,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should not show inshop-only error if dual or static recalibration, but should show that error instead.", async () => {
|
test("Should not show inshop-only error if dual or static recalibration, but should show that error instead.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: true,
|
isRecalibrationServiceableInshop: true,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: false,
|
isRecalibrationServiceableMobile: false,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -1363,14 +1358,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
test("Should not show dual/static recalibration error if not those recalibration types", async () => {
|
test("Should not show dual/static recalibration error if not those recalibration types", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
getServiceabilityDetails.mockImplementation(() =>
|
mockGetServiceabilityDetails = () =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
isGlassServiceableInshop: true,
|
isGlassServiceableInshop: true,
|
||||||
isRecalibrationServiceableInshop: true,
|
isRecalibrationServiceableInshop: true,
|
||||||
isGlassServiceableMobile: true,
|
isGlassServiceableMobile: true,
|
||||||
isRecalibrationServiceableMobile: true,
|
isRecalibrationServiceableMobile: true,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -513,8 +513,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.selectedProvider = new Provider();
|
this.selectedProvider = new Provider();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
selectedAppointmentType: {
|
selectedAppointmentType: {
|
||||||
handler(newValue) {
|
handler(newValue) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue