CSR-2091
CSR-2091 increase code coverage %
This commit is contained in:
parent
7ccb55d1b8
commit
73144f8347
2 changed files with 121 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import {
|
||||||
} from "@/helpers/heritage-integration/cookie-helper.js";
|
} from "@/helpers/heritage-integration/cookie-helper.js";
|
||||||
import { cookieNames } from "@/constants/cookie-names";
|
import { cookieNames } from "@/constants/cookie-names";
|
||||||
import { removeAllTestCookies, setupCookies, setupCrypto } from "@/helpers/unit-test-helper";
|
import { removeAllTestCookies, setupCookies, setupCrypto } from "@/helpers/unit-test-helper";
|
||||||
|
import { deleteFunnelCookie } from "./cookie-helper";
|
||||||
|
|
||||||
const randomUUID = "68d89736-c277-46f1-8fee-c3dacdb23c08";
|
const randomUUID = "68d89736-c277-46f1-8fee-c3dacdb23c08";
|
||||||
|
|
||||||
|
|
@ -119,6 +120,35 @@ describe("cookies", () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(actualCookieValue).toBeNull();
|
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", () => {
|
describe("Device Id", () => {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import { storeActions } from "@/constants/store-actions.js";
|
||||||
import { storeMutations } from "@/constants/store-mutations.js";
|
import { storeMutations } from "@/constants/store-mutations.js";
|
||||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||||
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
import { dynamicStrings } from "@/constants/dynamic-strings";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
describe("baseMixin.js", () => {
|
describe("baseMixin.js", () => {
|
||||||
|
|
@ -80,6 +82,28 @@ describe("baseMixin.js", () => {
|
||||||
expect(vehicleCategoriesForTest).toEqual(vehicleCategories);
|
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", () => {
|
test("onInvalidSubmit: puts focus on first error", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mixIn = getMixInInstance({});
|
const mixIn = getMixInInstance({});
|
||||||
|
|
@ -160,6 +184,71 @@ describe("baseMixin.js", () => {
|
||||||
|
|
||||||
expect(amtDue).toEqual("303.00");
|
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 }) {
|
function getMixInInstance({ isDispatchSuccess = true }) {
|
||||||
|
|
@ -184,6 +273,8 @@ function getMixInInstance({ isDispatchSuccess = true }) {
|
||||||
baseMixIn.methods.$route = route;
|
baseMixIn.methods.$route = route;
|
||||||
baseMixIn.methods.storeActions = storeActions;
|
baseMixIn.methods.storeActions = storeActions;
|
||||||
baseMixIn.methods.vehicleCategories = vehicleCategories;
|
baseMixIn.methods.vehicleCategories = vehicleCategories;
|
||||||
|
baseMixIn.methods.queryStrings = queryStrings;
|
||||||
|
baseMixIn.methods.dynamicStrings = dynamicStrings;
|
||||||
|
|
||||||
store.dispatch = storeDispatch;
|
store.dispatch = storeDispatch;
|
||||||
store.commit = jest.fn();
|
store.commit = jest.fn();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue