Formatting
This commit is contained in:
parent
a3853daa8f
commit
c37f8a2dfe
3 changed files with 32 additions and 27 deletions
|
|
@ -110,10 +110,10 @@ function setupMocks(customMountOptions = {}) {
|
|||
customMountOptions.route = {
|
||||
query: {
|
||||
fmgPage: "page-name",
|
||||
}
|
||||
},
|
||||
};
|
||||
const mountOptions = getMountOptions(customMountOptions);
|
||||
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||
|
|
@ -130,4 +130,4 @@ function setupMocks(customMountOptions = {}) {
|
|||
wrapper.vm.setCmsContent = jest.fn();
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ describe("payment-switch", () => {
|
|||
ImageId: "Credit Card Id",
|
||||
AnswerImageUrl: "Credit Card Image",
|
||||
SubWidgetName: "Credit Card SubWidget",
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -125,4 +125,4 @@ function setupMocks(customMountOptions) {
|
|||
// act on vm
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { getMountOptions } from "@/helpers/unit-test-helper";
|
|||
import store from "@/store";
|
||||
import baseMixin from "@/mixins/base-mixin";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||
|
||||
// Constants
|
||||
const parts = {
|
||||
|
|
@ -63,7 +63,7 @@ const pricedParts = {
|
|||
kitPrice: 0,
|
||||
laborAmount: 20,
|
||||
salesTax: 0,
|
||||
sellingPrice: 32.64
|
||||
sellingPrice: 32.64,
|
||||
},
|
||||
rearWipers: {
|
||||
...parts.rearWipers,
|
||||
|
|
@ -94,12 +94,12 @@ const taxedParts = {
|
|||
},
|
||||
rearWipers: {
|
||||
...pricedParts.rearWipers,
|
||||
salesTax: 6.00,
|
||||
salesTax: 6.0,
|
||||
subTotal: 100,
|
||||
},
|
||||
rainDefense: {
|
||||
...pricedParts.rainDefense,
|
||||
salesTax: 1.00,
|
||||
salesTax: 1.0,
|
||||
subTotal: 100,
|
||||
},
|
||||
};
|
||||
|
|
@ -111,7 +111,7 @@ let mockStoreActionData = {};
|
|||
|
||||
async function mockDispatchStoreAction(actionName) {
|
||||
return mockStoreActionData[actionName];
|
||||
};
|
||||
}
|
||||
|
||||
jest.mock("@/mixins/base-mixin.js", () => ({
|
||||
methods: {
|
||||
|
|
@ -175,7 +175,7 @@ describe("payment.vue", () => {
|
|||
damage: {
|
||||
isRepair: false,
|
||||
numberOfChips: null,
|
||||
glassToReplace: [{location: "windshield"}],
|
||||
glassToReplace: [{ location: "windshield" }],
|
||||
},
|
||||
lineItems: {
|
||||
glassParts: [parts.windshield],
|
||||
|
|
@ -220,8 +220,14 @@ describe("payment.vue", () => {
|
|||
},
|
||||
[storeActions.GET_WIPERS]: [parts.frontWipers, parts.rearWipers],
|
||||
[storeActions.GET_RAIN_DEFENSE]: parts.rainDefense,
|
||||
[storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA]: [pricedParts.windshield, pricedParts.frontWipers],
|
||||
[storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA]: [taxedParts.windshield, taxedParts.frontWipers],
|
||||
[storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA]: [
|
||||
pricedParts.windshield,
|
||||
pricedParts.frontWipers,
|
||||
],
|
||||
[storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA]: [
|
||||
taxedParts.windshield,
|
||||
taxedParts.frontWipers,
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -386,7 +392,7 @@ describe("payment.vue", () => {
|
|||
|
||||
describe("getPiaLineItems", () => {
|
||||
test("Properly formatted output", () => {
|
||||
// Arrange
|
||||
// Arrange
|
||||
const wrapper = setupMocks({});
|
||||
const cartItems = [
|
||||
taxedParts.windshield,
|
||||
|
|
@ -407,10 +413,7 @@ describe("payment.vue", () => {
|
|||
store.getters.order.lineItems.glassParts = null;
|
||||
|
||||
const wrapper = setupMocks({});
|
||||
const cartItems = [
|
||||
taxedParts.frontWipers,
|
||||
taxedParts.rainDefense,
|
||||
];
|
||||
const cartItems = [taxedParts.frontWipers, taxedParts.rainDefense];
|
||||
|
||||
// Act
|
||||
wrapper.vm.getPiaLineItems(cartItems);
|
||||
|
|
@ -422,12 +425,14 @@ describe("payment.vue", () => {
|
|||
|
||||
test("Does not include promos", () => {
|
||||
// Arrange
|
||||
store.getters.order.lineItems.promos = [{
|
||||
name: "PROMO",
|
||||
salesTax: 10,
|
||||
subTotal: 20,
|
||||
}];
|
||||
|
||||
store.getters.order.lineItems.promos = [
|
||||
{
|
||||
name: "PROMO",
|
||||
salesTax: 10,
|
||||
subTotal: 20,
|
||||
},
|
||||
];
|
||||
|
||||
const wrapper = setupMocks({});
|
||||
const cartItems = [
|
||||
taxedParts.windshield,
|
||||
|
|
@ -520,7 +525,7 @@ describe("payment.vue", () => {
|
|||
|
||||
// Act
|
||||
wrapper.vm.handleIFrameContentWindwMessage(event);
|
||||
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.backButtonAction).toBeCalled();
|
||||
});
|
||||
|
|
@ -535,7 +540,7 @@ describe("payment.vue", () => {
|
|||
|
||||
// Act
|
||||
wrapper.vm.handleIFrameContentWindwMessage(event);
|
||||
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.shouldBlockInteraction).toBe(true);
|
||||
});
|
||||
|
|
@ -551,7 +556,7 @@ describe("payment.vue", () => {
|
|||
wrapper.vm.setUIBlock(true);
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
|
||||
const uiBlockElements = wrapper.findAll(".ui-block");
|
||||
|
||||
// Assert
|
||||
|
|
|
|||
Loading…
Reference in a new issue