Unit tests & restore FBA functionality

This commit is contained in:
Chloe Herd 2024-07-09 13:07:06 -04:00
parent 58ea248079
commit f6fadd8ed8
3 changed files with 64 additions and 38 deletions

View file

@ -29,11 +29,26 @@ describe("checkbox-question.vue", () => {
expect(input.attributes().name).toEqual("Checkbox");
});
it("Should return checkbox id", async () => {
it("Should return default id when no custom id is specified", async () => {
// Act
const wrapper = shallowMount(checkboxQuestion, {
propsData: {
buttonID: "Checkbox ID",
},
mixins: [mockMixin],
});
// Assert
const input = wrapper.find("input");
// Expect
expect(input.attributes().id).not.toBeFalsy();
});
it("Should return custom id when specified", async () => {
// Act
const wrapper = shallowMount(checkboxQuestion, {
propsData: {
customInputId: "Checkbox ID",
},
mixins: [mockMixin],
});

View file

@ -47,7 +47,12 @@ describe("payment-method.vue", () => {
function setupMocks() {
store.getters = {
damage: {},
lineItems: [],
lineItems: {
glassParts: [],
supportingItems: [],
vaps: [],
promos: [],
},
order: {
payment: {
isPia: false,
@ -55,6 +60,12 @@ function setupMocks() {
isVerified: true,
},
},
lineItems: {
glassParts: [],
supportingItems: [],
vaps: [],
promos: [],
},
policy: {
currentDeductible: 123,
isNoComp: false,

View file

@ -486,41 +486,41 @@ export default {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction() {
// await this.dispatchStoreAction(
// storeActions.SAVE_PAYMENT_METHOD_CHOICE,
// this.paymentMethod,
// false
// );
// // save lineitems as they now have salestax added
// await this.dispatchStoreAction(
// storeActions.SAVE_GLASS_PARTS_SUPPRESSING_STATE_RESETTING,
// this.lineItems.glassParts,
// false
// );
// await this.dispatchStoreAction(
// storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
// this.lineItems.supportingItems,
// false
// );
// await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
// this.dispatchStoreAction(
// storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
// {
// activePromos: this.lineItems.promos,
// inactivePromos: this.inactivePromos,
// },
// false
// );
// if (this.paymentMethod == paymentMethods.LATER) {
// // this creates the final work order
// await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true });
// this.$router.navigateWithoutSaving(
// this.navigationScenarios.CLICKED_FORWARD,
// this.$route
// );
// } else {
// this.setupPia();
// }
await this.dispatchStoreAction(
storeActions.SAVE_PAYMENT_METHOD_CHOICE,
this.paymentMethod,
false
);
// save lineitems as they now have salestax added
await this.dispatchStoreAction(
storeActions.SAVE_GLASS_PARTS_SUPPRESSING_STATE_RESETTING,
this.lineItems.glassParts,
false
);
await this.dispatchStoreAction(
storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
this.lineItems.supportingItems,
false
);
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
this.dispatchStoreAction(
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
{
activePromos: this.lineItems.promos,
inactivePromos: this.inactivePromos,
},
false
);
if (this.paymentMethod == paymentMethods.LATER) {
// this creates the final work order
await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true });
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_FORWARD,
this.$route
);
} else {
this.setupPia();
}
},
async setupPia() {
this.$refs.loadingModal.showModal();