DigitalConsumer.FixMyGlass/src/helpers/pricing-helper.spec.js

64 lines
1.7 KiB
JavaScript

import {
getDisplayAmountDue,
getAmountDue,
getSubTotal,
getSalesTax,
} from "@/helpers/pricing-helper.js";
const lineItems = {
glassParts: [],
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: [],
};
describe("pricing-helper", () => {
describe("getDisplayAmountDue", () => {
it("should return the correct display amount due", () => {
const result = getDisplayAmountDue(lineItems);
expect(result).toBe("53.00");
});
});
describe("getAmountDue", () => {
it("should return the correct amount due", () => {
const result = getAmountDue(lineItems, true);
expect(result).toBe("53.00");
});
});
describe("getSubTotal", () => {
it("should return the correct subtotal", () => {
const result = getSubTotal(lineItems);
expect(result).toBe("50.00");
});
});
describe("getSalesTax", () => {
it("should return the correct sales tax", () => {
const result = getSalesTax(lineItems);
expect(result).toBe("3.00");
});
});
});