diff --git a/src/layouts/policy-endorsements/policy-endorsements.spec.js b/src/layouts/policy-endorsements/policy-endorsements.spec.js index ca26edb1..86b8fa73 100644 --- a/src/layouts/policy-endorsements/policy-endorsements.spec.js +++ b/src/layouts/policy-endorsements/policy-endorsements.spec.js @@ -30,12 +30,22 @@ describe('policyEndorsements.vue', () => { // Assert expect(siteSubHeader.exists()).toBe(true); }); - test('Should render buttonQuestion component', () => { + test('Should render schoolProperty buttonQuestion component', () => { // Arrange const wrapper = shallowMount(policyEndorsements, getMountOptions()); // Act - const buttonQuestion = wrapper.findComponent({ ref: 'endorsementQuestion' }); + const buttonQuestion = wrapper.findComponent({ ref: 'schoolPropertyQuestion' }); + + // Assert + expect(buttonQuestion.exists()).toBe(true); + }); + test('Should render parkingLot buttonQuestion component', () => { + // Arrange + const wrapper = shallowMount(policyEndorsements, getMountOptions()); + + // Act + const buttonQuestion = wrapper.findComponent({ ref: 'parkingLotQuestion' }); // Assert expect(buttonQuestion.exists()).toBe(true); @@ -85,7 +95,6 @@ describe('policyEndorsements.vue', () => { expect(wrapper.vm.$router.navigate) .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined); }); - // *TO DO: once service is ready, revise this test to ensure data is saved to the store test('Forward button clicked saves endorsement question answers', () => { // Arrange const mountOptions = getMountOptions({ @@ -96,13 +105,14 @@ describe('policyEndorsements.vue', () => { plugins: [createTestingPinia()] } }); + const wrapper = shallowMount(policyEndorsements, mountOptions); // Act wrapper.vm.forwardButtonAction(); // Assert - expect(useMainStore().saveEndorsementQuestionAnswers).toHaveBeenCalled(); + expect(useMainStore().saveEndorsementQuestionAnswers).toHaveBeenCalledWith(wrapper.vm.questionAnswersArray); }); }); }); diff --git a/src/layouts/policy-endorsements/policy-endorsements.vue b/src/layouts/policy-endorsements/policy-endorsements.vue index 70b77298..22154818 100644 --- a/src/layouts/policy-endorsements/policy-endorsements.vue +++ b/src/layouts/policy-endorsements/policy-endorsements.vue @@ -4,48 +4,50 @@ v-slot="{ meta }" @submit="onSubmit" @invalidSubmit="onInvalidSubmit"> -