Fixed unit tests

This commit is contained in:
Leah Schumann 2023-06-09 09:36:21 -04:00
parent 239faec2f7
commit 86f0f0fb94
4 changed files with 9 additions and 5 deletions

View file

@ -109,7 +109,8 @@ store.getters = {
damage: baseStoreGettersDamage,
order: {},
};
store.commit = jest.fn();
//store.commit = jest.fn();
store.dispatch = jest.fn();
afterEach(() => {
// reset store after each test

View file

@ -481,7 +481,7 @@ describe("vehicle-parts.vue", () => {
},
});
wrapper.vm.$store.commit = jest.fn();
wrapper.vm.dispatchStoreAction = jest.fn();
wrapper.setData({
selectedGlassParts: { "Rear-Stationary": { partNumber: "DB12209GTYN" } },
@ -498,7 +498,7 @@ describe("vehicle-parts.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$store.commit).toHaveBeenCalled();
expect(wrapper.vm.dispatchStoreAction).toHaveBeenCalled();
// TODO KO UNCOMMENT FOR QUOTE PAGES RELEASE
// expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(

View file

@ -442,7 +442,7 @@ export default {
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
// save to store lineItems.glassParts
self.$store.dispatch(storeActions.SAVE_GLASS_PARTS, collectedGlassParts);
self.dispatchStoreAction(storeActions.SAVE_GLASS_PARTS, collectedGlassParts, false);
const payment = store.getters.payment;

View file

@ -961,7 +961,10 @@ describe("Actions", () => {
it("saveGlassParts, should call mutation", () => {
// Arrange
const context = state;
const context = {
state: state,
};
const commit = jest.fn();
context.commit = commit;