CASH-2802 - GA for Mobile Availability
This commit is contained in:
parent
2d3a9af49e
commit
fe886fa77d
2 changed files with 36 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import scheduling from "./scheduling";
|
||||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||||
|
import { GaActions, GaCategories, GaLabels } from "@/constants/analytics";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
jest.mock("@/store", () => ({
|
jest.mock("@/store", () => ({
|
||||||
|
|
@ -286,6 +287,30 @@ describe("scheduling.vue", () => {
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
["yes", "12345", GaLabels.YES],
|
||||||
|
["no", null, GaLabels.NO],
|
||||||
|
])(
|
||||||
|
"pushes mobile_available %s when mobileProviderNumber is %s",
|
||||||
|
async (_label, mobileProviderNumber, expectedGaLabel) => {
|
||||||
|
settleAllPromises.mockResolvedValueOnce({});
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
wrapper.vm.pushEventToGA.mockClear();
|
||||||
|
|
||||||
|
await wrapper.vm.loadSchedulingData("43235", {
|
||||||
|
providersResult: { shopProviders: [], mobileProviderNumber },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.vm.pushEventToGA).toHaveBeenCalledWith(
|
||||||
|
GaCategories.APPOINTMENT,
|
||||||
|
GaActions.MOBILE_AVAILABLE,
|
||||||
|
expectedGaLabel,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
wrapper.unmount();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test("navigates to service-zip when zip changes and recal acknowledgement applies", async () => {
|
test("navigates to service-zip when zip changes and recal acknowledgement applies", async () => {
|
||||||
store.getters.order.lineItems = {
|
store.getters.order.lineItems = {
|
||||||
glassParts: [
|
glassParts: [
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,17 @@ export default {
|
||||||
? { providerNumber: mobileProviderNumber, timeSlots: null }
|
? { providerNumber: mobileProviderNumber, timeSlots: null }
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
var gaLabel = this.GaLabels.NO;
|
||||||
|
if (this.mobileProviderAndTimeSlot) {
|
||||||
|
gaLabel = this.GaLabels.YES;
|
||||||
|
}
|
||||||
|
this.pushEventToGA(
|
||||||
|
this.GaCategories.APPOINTMENT,
|
||||||
|
this.GaActions.MOBILE_AVAILABLE,
|
||||||
|
gaLabel,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
const startDate = toDateString(0);
|
const startDate = toDateString(0);
|
||||||
const endDate = toDateString(SCHEDULE_FETCH_DAYS - 1);
|
const endDate = toDateString(SCHEDULE_FETCH_DAYS - 1);
|
||||||
const providerNumbers = providers.map((provider) => provider.providerNumber);
|
const providerNumbers = providers.map((provider) => provider.providerNumber);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue