diff --git a/ppr-ui/tests/unit/MhrInformation.spec.ts b/ppr-ui/tests/unit/MhrInformation.spec.ts index 339897647..79feb0b25 100644 --- a/ppr-ui/tests/unit/MhrInformation.spec.ts +++ b/ppr-ui/tests/unit/MhrInformation.spec.ts @@ -41,7 +41,9 @@ import { mockedUnitNotes5, mockedPerson2, mockedExecutor, - mockedAdministrator + mockedAdministrator, + mockedResidentialExemptionOrder, + mockedUnitNotes3 } from './test-data' import { CertifyIF, @@ -1040,4 +1042,28 @@ describe('Mhr Information', () => { expect(CautionBoxComponent.find('.v-icon').classes('alert-icon')).toBeTruthy() expect(CautionBoxComponent.text()).toContain(UnitNotesInfo[UnitNoteDocTypes.NOTICE_OF_TAX_SALE].header) }) + + it('should have read only view for exempt MHR (Residential Exemption filed)', async () => { + wrapper = createComponent() + + // add unit notes with Residential Exemption + await store.setMhrUnitNotes([mockedResidentialExemptionOrder, ...mockedUnitNotes3]) + await store.setAuthRoles([AuthRoles.PPR_STAFF]) + wrapper.vm.dataLoaded = true + await nextTick() + + expect(wrapper.find(getTestId('correct-into-desc')).exists()).toBeFalsy() + expect(wrapper.find(getTestId('mhr-alert-msg')).exists()).toBeTruthy() + // message for Staff should contain unique text + expect(wrapper.find(getTestId('mhr-alert-msg')).text()).toContain('See Unit Notes for further information') + expect(wrapper.find(HomeOwners).find('#home-owners-change-btn').exists()).toBeFalsy() + + // setup Qualified Supplier as Manufacturer + await store.setAuthRoles([AuthRoles.MHR_TRANSFER_SALE]) + await store.setUserProductSubscriptionsCodes([ProductCode.MANUFACTURER]) + await nextTick() + + // message for QS should contain unique text + expect(wrapper.find(getTestId('mhr-alert-msg')).text()).toContain('contact BC Registries staff') + }) }) diff --git a/ppr-ui/tests/unit/Tombstone.spec.ts b/ppr-ui/tests/unit/Tombstone.spec.ts index fc2c7d231..9e6000616 100644 --- a/ppr-ui/tests/unit/Tombstone.spec.ts +++ b/ppr-ui/tests/unit/Tombstone.spec.ts @@ -15,7 +15,7 @@ import { AccountInformationIF, FinancingStatementIF, UserInfoIF } from '@/interf import { mockedFinancingStatementComplete, mockedSelectSecurityAgreement } from './test-data' import mockRouter from './MockRouter' import { AuthRoles, ProductCode, RouteNames } from '@/enums' -import { convertDate, pacificDate } from '@/utils' +import { pacificDate } from '@/utils' Vue.use(Vuetify) @@ -150,7 +150,7 @@ describe('Tombstone component', () => { expect(extraInfo.length).toBe(0) }) - it('renders Tombstone component peoperly for Search', async () => { + it('renders Tombstone component properly for Search', async () => { wrapper = createComponent(RouteNames.SEARCH) await nextTick() @@ -168,7 +168,7 @@ describe('Tombstone component', () => { expect(extraInfo.length).toBe(0) }) - it('renders Tombstone component peoperly for New Registration: length-trust', async () => { + it('renders Tombstone component properly for New Registration: length-trust', async () => { wrapper = createComponent(RouteNames.LENGTH_TRUST) await nextTick() @@ -186,7 +186,7 @@ describe('Tombstone component', () => { expect(extraInfo.length).toBe(0) }) - it('renders Tombstone component peoperly for New Registration: parties/debtors', async () => { + it('renders Tombstone component properly for New Registration: parties/debtors', async () => { wrapper = createComponent(RouteNames.ADD_SECUREDPARTIES_AND_DEBTORS) await nextTick() @@ -204,7 +204,7 @@ describe('Tombstone component', () => { expect(extraInfo.length).toBe(0) }) - it('renders Tombstone component peoperly for New Registration: collateral', async () => { + it('renders Tombstone component properly for New Registration: collateral', async () => { wrapper = createComponent(RouteNames.ADD_COLLATERAL) await nextTick() @@ -222,7 +222,7 @@ describe('Tombstone component', () => { expect(extraInfo.length).toBe(0) }) - it('renders Tombstone component peoperly for New Registration: review/confirm', async () => { + it('renders Tombstone component properly for New Registration: review/confirm', async () => { wrapper = createComponent(RouteNames.REVIEW_CONFIRM) await nextTick() diff --git a/ppr-ui/tests/unit/TombstoneDischarge.spec.ts b/ppr-ui/tests/unit/TombstoneDischarge.spec.ts index 1f73ddf28..c4e5ae56f 100644 --- a/ppr-ui/tests/unit/TombstoneDischarge.spec.ts +++ b/ppr-ui/tests/unit/TombstoneDischarge.spec.ts @@ -1,5 +1,5 @@ // Libraries -import Vue, { nextTick } from 'vue' +import Vue from 'vue' import Vuetify from 'vuetify' import VueRouter from 'vue-router' import { createPinia, setActivePinia } from 'pinia' @@ -12,7 +12,12 @@ import { TombstoneDischarge } from '@/components/tombstone' // Other import { FinancingStatementIF } from '@/interfaces' -import { mockedFinancingStatementComplete, mockedMhrInformation, mockedSelectSecurityAgreement } from './test-data' +import { + mockedFinancingStatementComplete, + mockedMhrInformation, + mockedMhrInformationExempt, + mockedSelectSecurityAgreement +} from './test-data' import mockRouter from './MockRouter' import { RouteNames } from '@/enums' import { pacificDate } from '@/utils' @@ -191,4 +196,16 @@ describe('TombstoneDischarge component - MHR', () => { expect(extraInfo.at(0).text()).toContain('Registration Status:') expect(extraInfo.at(0).text()).toContain('Cancelled') }) + + it('should render Tombstone component for Exempt MHR (Residential Exemption unit note)', async () => { + await store.setMhrInformation(mockedMhrInformationExempt) + wrapper = createComponent(RouteNames.MHR_INFORMATION) + const tombstoneDischarge = wrapper.findComponent(TombstoneDischarge) + tombstoneDischarge.vm.isMhrInformation = true + await Vue.nextTick() + + expect(tombstoneDischarge.find(tombstoneHeader).text()) + .toContain('Manufactured Home Registration Number ' + mockedMhrInformationExempt.mhrNumber) + expect(tombstoneDischarge.find(tombstoneInfo).text()).toContain(mockedMhrInformationExempt.statusType) + }) }) diff --git a/ppr-ui/tests/unit/UnitNotePanels.spec.ts b/ppr-ui/tests/unit/UnitNotePanels.spec.ts index f58bbc0bc..93664967a 100644 --- a/ppr-ui/tests/unit/UnitNotePanels.spec.ts +++ b/ppr-ui/tests/unit/UnitNotePanels.spec.ts @@ -4,10 +4,11 @@ import { createPinia, setActivePinia } from 'pinia' import { useStore } from '../../src/store/store' import { mount, createLocalVue, Wrapper } from '@vue/test-utils' import { UnitNoteContentInfo, UnitNoteHeaderInfo, UnitNotePanel, UnitNotePanels } from '../../src/components/unitNotes' -import { UnitNoteDocTypes, UnitNoteStatusTypes } from '../../src/enums' +import { AuthRoles, ProductCode, UnitNoteDocTypes, UnitNoteStatusTypes } from '../../src/enums' import { mockedCancelledTaxSaleNote, mockedNoticeOfRedemption, + mockedResidentialExemptionOrder, mockedUnitNotes, mockedUnitNotes2, mockedUnitNotes3, @@ -17,7 +18,7 @@ import { } from './test-data' import { BaseAddress } from '@/composables/address' import { pacificDate, shortPacificDate } from '@/utils' -import { UnitNotesInfo, cancelledWithRedemptionNote } from '@/resources/unitNotes' +import { ResidentialExemptionQSDropDown, ResidentialExemptionStaffDropDown, UnitNotesInfo, cancelledWithRedemptionNote } from '@/resources/unitNotes' import { CancelUnitNoteIF, UnitNoteIF, UnitNotePanelIF } from '@/interfaces' import { getTestId } from './utils' import { useMhrUnitNote } from '@/composables' @@ -471,4 +472,50 @@ describe('UnitNotePanels', () => { `${UnitNotesInfo[UnitNoteDocTypes.NOTICE_OF_TAX_SALE].header} ${cancelledWithRedemptionNote}` ) }) + + it('should show correct view for Staff and QS for Residential Exemption note', async () => { + const mixedNotes: UnitNoteIF[] = + [...mockedUnitNotes4, mockedResidentialExemptionOrder] + + let wrapper = createComponent(mixedNotes) + wrapper.setProps({ hasResExemption: true }) + + // set Qualified Supplier role + await store.setAuthRoles([AuthRoles.MHR_TRANSFER_SALE]) + await store.setUserProductSubscriptionsCodes([ProductCode.MANUFACTURER]) + + wrapper.find('#open-unit-notes-btn').trigger('click') + await nextTick() + + // check dropdown for Qualified Supplier + expect(wrapper.vm.addUnitNoteDropdown).toBe(ResidentialExemptionQSDropDown) + + // set Staff role + await store.setAuthRoles([AuthRoles.STAFF, AuthRoles.PPR_STAFF]) + + wrapper = createComponent(mixedNotes) + wrapper.setProps({ hasResExemption: true }) + + wrapper.find('#open-unit-notes-btn').trigger('click') + await nextTick() + await nextTick() + + // check dropdown for Staff + expect(wrapper.vm.addUnitNoteDropdown).toBe(ResidentialExemptionStaffDropDown) + + const resExemptionPanel = wrapper.findAllComponents(UnitNotePanel).at(1) + expect(resExemptionPanel.find('h3').text()).toBe(UnitNotesInfo[UnitNoteDocTypes.RESIDENTIAL_EXEMPTION_ORDER].header) + + // expand Res Exemption panel + resExemptionPanel.find('.unit-note-menu-btn').trigger('click') + await nextTick() + await nextTick() + + const resExemptionContentInfo = resExemptionPanel.findComponent(UnitNoteContentInfo) + + // check visible and hidden sections of the panel info + expect(resExemptionContentInfo.find(getTestId('effective-date-info')).exists()).toBe(false) + expect(resExemptionContentInfo.find(getTestId('remarks-info')).exists()).toBe(true) + expect(resExemptionContentInfo.find(getTestId('person-giving-notice-info')).exists()).toBe(false) + }) }) diff --git a/ppr-ui/tests/unit/test-data/mock-registration-new.ts b/ppr-ui/tests/unit/test-data/mock-registration-new.ts index f495232fc..ceb043320 100644 --- a/ppr-ui/tests/unit/test-data/mock-registration-new.ts +++ b/ppr-ui/tests/unit/test-data/mock-registration-new.ts @@ -1,4 +1,4 @@ -import { APIRegistrationTypes, DraftTypes, UIRegistrationTypes, APIVehicleTypes, ActionTypes } from '@/enums' +import { APIRegistrationTypes, DraftTypes, APIVehicleTypes, ActionTypes, MhApiStatusTypes } from '@/enums' import { RegistrationTypesMiscellaneousCC, RegistrationTypesStandard, @@ -448,3 +448,15 @@ export const mockedMhrInformation: MhRegistrationSummaryIF = { submittingParty: 'ABC SUBMITTING COMPANY', username: 'BUSINESS REGISTRY TEST 1' } + +export const mockedMhrInformationExempt: MhRegistrationSummaryIF = { + clientReferenceId: 'UT-MHREG-SOLE', + createDateTime: '2023-10-15T09:18:13-07:00', + mhrNumber: '150575', + ownerNames: 'MARY-ANNE BICKNELL', + path: '/mhr/api/v1/registrations/150575', + registrationDescription: 'MANUFACTURED HOME REGISTRATION', + statusType: MhApiStatusTypes.EXEMPT.toLocaleLowerCase(), + submittingParty: 'ABC SUBMITTING COMPANY', + username: 'BUSINESS REGISTRY TEST 1' +} diff --git a/ppr-ui/tests/unit/test-data/mock-unit-notes.ts b/ppr-ui/tests/unit/test-data/mock-unit-notes.ts index 7b0ffb3c3..2b399fdb0 100644 --- a/ppr-ui/tests/unit/test-data/mock-unit-notes.ts +++ b/ppr-ui/tests/unit/test-data/mock-unit-notes.ts @@ -444,3 +444,16 @@ export const mockedNoticeOfRedemption: CancelUnitNoteIF = { status: UnitNoteStatusTypes.ACTIVE, destroyed: false } + +// Residential Exemption - EXRS type +export const mockedResidentialExemptionOrder: UnitNoteIF = { + documentType: UnitNoteDocTypes.RESIDENTIAL_EXEMPTION_ORDER, + documentId: '12345678', + documentRegistrationNumber: '5544332', + documentDescription: UnitNotesInfo[UnitNoteDocTypes.RESIDENTIAL_EXEMPTION_ORDER].header, + createDateTime: '2023-08-20T09:00:00Z', + effectiveDateTime: '2023-08-20T09:00:00Z', + remarks: 'Residential Exemption remarks', + status: UnitNoteStatusTypes.ACTIVE, + destroyed: false +}