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"); 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 // Act
const wrapper = shallowMount(checkboxQuestion, { const wrapper = shallowMount(checkboxQuestion, {
propsData: { 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], mixins: [mockMixin],
}); });

View file

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

View file

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