commit
1259cc5008
3 changed files with 124 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import {
|
|||
} from "@/helpers/heritage-integration/cookie-helper.js";
|
||||
import { cookieNames } from "@/constants/cookie-names";
|
||||
import { removeAllTestCookies, setupCookies, setupCrypto } from "@/helpers/unit-test-helper";
|
||||
import { deleteFunnelCookie } from "./cookie-helper";
|
||||
|
||||
const randomUUID = "68d89736-c277-46f1-8fee-c3dacdb23c08";
|
||||
|
||||
|
|
@ -119,6 +120,34 @@ describe("cookies", () => {
|
|||
// Assert
|
||||
expect(actualCookieValue).toBeNull();
|
||||
});
|
||||
|
||||
test("delete should not return a cookie", () => {
|
||||
// Arrange
|
||||
const testReferralNumber = 1566818;
|
||||
const testReferralDate = "2022-03-15T10:56:24.597";
|
||||
const testReferralCorrelationId = "404d2b04-f86e-45c3-b373-127b6217b060";
|
||||
const testShouldResetState = false;
|
||||
const testDidHeritageFunnelUpdateLast = true;
|
||||
|
||||
const testCookieValue = {
|
||||
ReferralNumber: testReferralNumber,
|
||||
ReferralDate: testReferralDate,
|
||||
ReferralCorrelationId: testReferralCorrelationId,
|
||||
ShouldResetState: testShouldResetState,
|
||||
DidHeritageFunnelUpdateLast: testDidHeritageFunnelUpdateLast,
|
||||
SuppressConceptFunnel: true,
|
||||
};
|
||||
|
||||
setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) });
|
||||
|
||||
// Act
|
||||
deleteFunnelCookie();
|
||||
var result = getFunnelCookie();
|
||||
|
||||
// Assert
|
||||
expect(result).not.toEqual(testCookieValue);
|
||||
expect(typeof result).toEqual("object");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Device Id", () => {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { storeActions } from "@/constants/store-actions.js";
|
|||
import { storeMutations } from "@/constants/store-mutations.js";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { dynamicStrings } from "@/constants/dynamic-strings";
|
||||
import store from "@/store";
|
||||
|
||||
describe("baseMixin.js", () => {
|
||||
|
|
@ -80,6 +82,28 @@ describe("baseMixin.js", () => {
|
|||
expect(vehicleCategoriesForTest).toEqual(vehicleCategories);
|
||||
});
|
||||
|
||||
test("computed: queryStrings should be equal to import object", () => {
|
||||
// Arrange
|
||||
const mixIn = getMixInInstance({});
|
||||
|
||||
// Act
|
||||
let queryStringsForTest = mixIn.computed.queryStrings();
|
||||
|
||||
// Assert
|
||||
expect(queryStringsForTest).toEqual(queryStrings);
|
||||
});
|
||||
|
||||
test("computed: dynamicStrings should be equal to import object", () => {
|
||||
// Arrange
|
||||
const mixIn = getMixInInstance({});
|
||||
|
||||
// Act
|
||||
let dynamicStringsForTest = mixIn.computed.dynamicStrings();
|
||||
|
||||
// Assert
|
||||
expect(dynamicStringsForTest).toEqual(dynamicStrings);
|
||||
});
|
||||
|
||||
test("onInvalidSubmit: puts focus on first error", () => {
|
||||
// Arrange
|
||||
const mixIn = getMixInInstance({});
|
||||
|
|
@ -160,6 +184,72 @@ describe("baseMixin.js", () => {
|
|||
|
||||
expect(amtDue).toEqual("303.00");
|
||||
});
|
||||
|
||||
test("getAmountDue for cash should sum lineitems", () => {
|
||||
const mixIn = getMixInInstance({});
|
||||
const lineItems = {
|
||||
glassParts: [
|
||||
{
|
||||
partNumber: "FW06143GTYN",
|
||||
description:
|
||||
"solar, heads-up display, third visor frit, soundproofing, rain/light sensor, lane departure warning system",
|
||||
color: "Green Tint",
|
||||
partType: "WINDSHIELD",
|
||||
canSafeliteRecalibrate: true,
|
||||
requiresRecalibration: true,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "STATIC",
|
||||
childParts: [
|
||||
{
|
||||
partNumber: "RS 101 PAD",
|
||||
kitPrice: 0,
|
||||
laborAmount: 0,
|
||||
salesTax: 5.0,
|
||||
sellingPrice: 5.0,
|
||||
},
|
||||
],
|
||||
id: "73e80976-79be-455a-b4e7-f9b058b61749",
|
||||
kitPrice: 0,
|
||||
laborAmount: 60,
|
||||
salesTax: 20.0,
|
||||
sellingPrice: 1000.0,
|
||||
},
|
||||
],
|
||||
supportingItems: [],
|
||||
vaps: [
|
||||
{
|
||||
cartItemType: "FRONT WIPERS",
|
||||
description: 'WIPER BLADE STANDARD 18"',
|
||||
kitPrice: 0,
|
||||
laborAmount: 0,
|
||||
partNumber: "WB18",
|
||||
partType: "FRONT WIPER",
|
||||
salesTax: 2.0,
|
||||
sellingPrice: 30.0,
|
||||
},
|
||||
{
|
||||
cartItemType: "FRONT WIPERS",
|
||||
description: 'WIPER BLADE STANDARD 26"',
|
||||
kitPrice: 0,
|
||||
laborAmount: 0,
|
||||
partNumber: "WB26",
|
||||
partType: "FRONT WIPER",
|
||||
salesTax: 1.0,
|
||||
sellingPrice: 20.0,
|
||||
},
|
||||
],
|
||||
promos: [],
|
||||
};
|
||||
|
||||
store.getters = {
|
||||
payment: { isInsurance: null, insuranceCoverage: { isVerified: null } },
|
||||
policy: { isNoComp: false, isItac: false, currentDeductible: 0 },
|
||||
};
|
||||
|
||||
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
||||
|
||||
expect(amtDue).toEqual("1143.00");
|
||||
});
|
||||
});
|
||||
|
||||
function getMixInInstance({ isDispatchSuccess = true }) {
|
||||
|
|
@ -184,6 +274,8 @@ function getMixInInstance({ isDispatchSuccess = true }) {
|
|||
baseMixIn.methods.$route = route;
|
||||
baseMixIn.methods.storeActions = storeActions;
|
||||
baseMixIn.methods.vehicleCategories = vehicleCategories;
|
||||
baseMixIn.methods.queryStrings = queryStrings;
|
||||
baseMixIn.methods.dynamicStrings = dynamicStrings;
|
||||
|
||||
store.dispatch = storeDispatch;
|
||||
store.commit = jest.fn();
|
||||
|
|
|
|||
|
|
@ -2670,6 +2670,9 @@ export const actions = {
|
|||
// clear vuex
|
||||
context.commit(storeMutations.RESET_STATE);
|
||||
|
||||
// delete cookie
|
||||
deleteFunnelCookie();
|
||||
|
||||
//restore user's experiments
|
||||
context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue