Merge pull request #3302 from Safelite/feature/CASH-2802
CASH-2802 - GA for Mobile Availability
This commit is contained in:
commit
9d696e2b2f
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 { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||
import { GaActions, GaCategories, GaLabels } from "@/constants/analytics";
|
||||
import store from "@/store";
|
||||
|
||||
jest.mock("@/store", () => ({
|
||||
|
|
@ -286,6 +287,30 @@ describe("scheduling.vue", () => {
|
|||
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 () => {
|
||||
store.getters.order.lineItems = {
|
||||
glassParts: [
|
||||
|
|
|
|||
|
|
@ -439,6 +439,17 @@ export default {
|
|||
? { providerNumber: mobileProviderNumber, timeSlots: 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 endDate = toDateString(SCHEDULE_FETCH_DAYS - 1);
|
||||
const providerNumbers = providers.map((provider) => provider.providerNumber);
|
||||
|
|
|
|||
Loading…
Reference in a new issue