Skip to content

Commit

Permalink
No Certification checkbox error on MHR Info page (#1577)
Browse files Browse the repository at this point in the history
* No Certification checkbox error on MHR Info page
  • Loading branch information
RuoxuanPengBC authored Oct 17, 2023
1 parent 81b88e3 commit d572839
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,56 +61,54 @@

<v-divider class="mx-8"/>

<!-- CSA Review -->
<template v-if="isCSA || isEngineerInspection">
<template v-if="isCSA">
<v-row no-gutters class="py-6 px-8">
<v-col cols="3" class="pt-1">
<h3>CSA Number</h3>
</v-col>
<v-col cols="9" class="pt-1">
<p>{{ getMhrRegistrationHomeDescription.csaNumber || '(Not Entered)' }}</p>
</v-col>
<v-col cols="3" class="pt-1">
<h3>CSA Standard</h3>
</v-col>
<v-col cols="9" class="pt-1">
<p>{{ getMhrRegistrationHomeDescription.csaStandard || '(Not Entered)' }}</p>
</v-col>
</v-row>
</template>

<!-- Engineer Review -->
<template v-else-if="isEngineerInspection">
<v-row no-gutters class="py-6 px-8">
<v-col cols="3" class="pt-1">
<h3>Engineer's Name</h3>
</v-col>
<v-col cols="9" class="pt-1">
<p>{{ getMhrRegistrationHomeDescription.engineerName || '(Not Entered)' }}</p>
</v-col>
<v-col cols="3" class="pt-1 pr-2">
<h3>Date of Engineer's Report</h3>
</v-col>
<v-col cols="9" class="pt-1">
<p>{{ engineerDisplayDate || '(Not Entered)' }}</p>
</v-col>
</v-row>
</template>
</template>

<!-- Has no home certification is checked -->
<template v-else-if="getMhrRegistrationHomeDescription.hasNoCertification">
<template v-if="getMhrRegistrationHomeDescription.hasNoCertification">
<v-row no-gutters class="pa-6">
<v-col cols="3">
<v-col cols="3" data-test-id="home-certification-header-1">
<h3>Home Certification</h3>
</v-col>
<v-col cols="9">
<v-col cols="9" data-test-id="home-certification-content-1">
<p>There is no certification available for this home.</p>
</v-col>
</v-row>
</template>

<!-- CSA Review -->
<template v-else-if="isCSA">
<v-row no-gutters class="py-6 px-8">
<v-col cols="3" class="pt-1" data-test-id="home-certification-header-1-csa">
<h3>CSA Number</h3>
</v-col>
<v-col cols="9" class="pt-1" data-test-id="home-certification-content-1-csa">
<p>{{ getMhrRegistrationHomeDescription.csaNumber || '(Not Entered)' }}</p>
</v-col>
<v-col cols="3" class="pt-1" data-test-id="home-certification-header-2-csa">
<h3>CSA Standard</h3>
</v-col>
<v-col cols="9" class="pt-1" data-test-id="home-certification-content-2-csa">
<p>{{ getMhrRegistrationHomeDescription.csaStandard || '(Not Entered)' }}</p>
</v-col>
</v-row>
</template>

<!-- Engineer Review -->
<template v-else-if="isEngineerInspection">
<v-row no-gutters class="py-6 px-8">
<v-col cols="3" class="pt-1" data-test-id="home-certification-header-1-eng">
<h3>Engineer's Name</h3>
</v-col>
<v-col cols="9" class="pt-1" data-test-id="home-certification-content-1-eng">
<p>{{ getMhrRegistrationHomeDescription.engineerName || '(Not Entered)' }}</p>
</v-col>
<v-col cols="3" class="pt-1" data-test-id="home-certification-header-2-eng">
<h3>Date of Engineer's Report</h3>
</v-col>
<v-col cols="9" class="pt-1" data-test-id="home-certification-content-2-eng">
<p>{{ engineerDisplayDate || '(Not Entered)' }}</p>
</v-col>
</v-row>
</template>

<!-- No option selected -->
<template v-else>
<v-row no-gutters class="pa-6">
Expand Down
66 changes: 65 additions & 1 deletion ppr-ui/tests/unit/MhrReviewConfirm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { HomeLocationReview, HomeOwnersReview,
SubmittingPartyReview, YourHomeReview } from '@/components/mhrRegistration/ReviewConfirm'
import { AccountInfo, Attention, CautionBox, CertifyInformation,
ContactUsToggle, FolioOrReferenceNumber, FormField } from '@/components/common'
import { HomeTenancyTypes, ProductCode, RouteNames } from '@/enums'
import { HomeTenancyTypes, ProductCode, RouteNames, HomeCertificationOptions } from '@/enums'
import mockRouter from './MockRouter'
import { mockedFractionalOwnership, mockedPerson } from './test-data/mock-mhr-registration'
import { MhrRegistrationHomeOwnerGroupIF, MhrRegistrationHomeOwnerIF } from '@/interfaces/mhr-registration-interfaces'
Expand Down Expand Up @@ -250,4 +250,68 @@ describe('Mhr Manufacturer Registration Review and Confirm', () => {
expect((attention.findComponent(FormField) as Wrapper<any>).vm.inputModel).toBe('TEST 123')
expect((folio.findComponent(FormField) as Wrapper<any>).vm.inputModel).toBe('TEST 245')
})

it('incorrect behavior if no certification checkbox is checked', async () => {
const yourHomeReview = wrapper.findComponent(YourHomeReview)
expect(yourHomeReview.exists()).toBeTruthy()
await store.setMhrHomeDescription({key: 'hasNoCertification', value: true})
expect(yourHomeReview.find(getTestId('home-certification-header-1')).text()).toBe('Home Certification')
expect(yourHomeReview
.find(getTestId('home-certification-content-1'))
.text()).toBe('There is no certification available for this home.')
})

it('incorrect behavior in home certification - CSA number', async () => {
const yourHomeReview = wrapper.findComponent(YourHomeReview)
expect(yourHomeReview.exists()).toBeTruthy()
await store.setMhrHomeDescription({key: 'hasNoCertification', value: false})
await nextTick()

await store.setMhrHomeDescription({key: 'certificationOption', value: HomeCertificationOptions.CSA})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-csa')).text()).toBe('CSA Number')
expect(yourHomeReview.find(getTestId('home-certification-content-1-csa')).text()).toBe('(Not Entered)')
expect(yourHomeReview.find(getTestId('home-certification-header-2-csa')).text()).toBe('CSA Standard')
expect(yourHomeReview.find(getTestId('home-certification-content-2-csa')).text()).toBe('(Not Entered)')

await store.setMhrHomeDescription({key: 'csaNumber', value: '32123'})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-csa')).text()).toBe('CSA Number')
expect(yourHomeReview.find(getTestId('home-certification-content-1-csa')).text()).toBe('32123')
expect(yourHomeReview.find(getTestId('home-certification-header-2-csa')).text()).toBe('CSA Standard')
expect(yourHomeReview.find(getTestId('home-certification-content-2-csa')).text()).toBe('(Not Entered)')

await store.setMhrHomeDescription({key: 'csaStandard', value: 'A277'})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-csa')).text()).toBe('CSA Number')
expect(yourHomeReview.find(getTestId('home-certification-content-1-csa')).text()).toBe('32123')
expect(yourHomeReview.find(getTestId('home-certification-header-2-csa')).text()).toBe('CSA Standard')
expect(yourHomeReview.find(getTestId('home-certification-content-2-csa')).text()).toBe('A277')
})

it('incorrect behavior in home certification - Engineer Inspection', async () => {
const yourHomeReview = wrapper.findComponent(YourHomeReview)
expect(yourHomeReview.exists()).toBeTruthy()
await store.setMhrHomeDescription({key: 'certificationOption',
value: HomeCertificationOptions.ENGINEER_INSPECTION})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-eng')).text()).toBe('Engineer\'s Name')
expect(yourHomeReview.find(getTestId('home-certification-content-1-eng')).text()).toBe('(Not Entered)')
expect(yourHomeReview.find(getTestId('home-certification-header-2-eng')).text()).toBe('Date of Engineer\'s Report')
expect(yourHomeReview.find(getTestId('home-certification-content-2-eng')).text()).toBe('(Not Entered)')

await store.setMhrHomeDescription({key: 'engineerName', value: 'John Doe'})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-eng')).text()).toBe('Engineer\'s Name')
expect(yourHomeReview.find(getTestId('home-certification-content-1-eng')).text()).toBe('John Doe')
expect(yourHomeReview.find(getTestId('home-certification-header-2-eng')).text()).toBe('Date of Engineer\'s Report')
expect(yourHomeReview.find(getTestId('home-certification-content-2-eng')).text()).toBe('(Not Entered)')

await store.setMhrHomeDescription({key: 'engineerDate', value: '2023-10-10'})
await nextTick()
expect(yourHomeReview.find(getTestId('home-certification-header-1-eng')).text()).toBe('Engineer\'s Name')
expect(yourHomeReview.find(getTestId('home-certification-content-1-eng')).text()).toBe('John Doe')
expect(yourHomeReview.find(getTestId('home-certification-header-2-eng')).text()).toBe('Date of Engineer\'s Report')
expect(yourHomeReview.find(getTestId('home-certification-content-2-eng')).text()).toBe('October 10, 2023')
})
})

0 comments on commit d572839

Please sign in to comment.