Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions strr-examiner-web/app/components/Host/SupportingInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,15 @@ const docStore = useExaminerDocumentStore()
const { isPrUploadOpen } = storeToRefs(docStore)

// Principal Residence Requirements:
const getPrRequired = (): string => {
if (!isApplication.value) {
return ''
}
return activeReg.value?.strRequirements?.isPrincipalResidenceRequired
const getPrRequired = (): string =>
activeReg.value?.strRequirements?.isPrincipalResidenceRequired

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont we need to update the test cases for the changes in this file. i only see one path being tested which is the Required one. Are the rest already covered somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added test cases for the changes, thanks!

? t('pr.required')
: t('pr.notRequired')
}

const getBlRequired = (): string => {
if (!isApplication.value) {
return ''
}
return activeReg.value?.strRequirements?.isBusinessLicenceRequired
const getBlRequired = (): string =>
activeReg.value?.strRequirements?.isBusinessLicenceRequired
? t('pr.required')
: t('pr.notRequired')
}

const prExemptReason = computed(() => activeReg.value?.unitDetails?.prExemptReason)
const businessLicenseExemptReason = computed(() => activeReg.value?.unitDetails?.blExemptReason)
Expand Down
2 changes: 1 addition & 1 deletion strr-examiner-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-examiner-web",
"private": true,
"type": "module",
"version": "0.2.52",
"version": "0.2.53",
"engines": {
"node": ">=24"
},
Expand Down
11 changes: 11 additions & 0 deletions strr-examiner-web/tests/mocks/mockedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,17 @@ export const mockStrataHotelRegistration: StrataHotelRegistrationResp = {
nocStatus: null
}

export const mockHostRegistrationNotRequired: HostRegistrationResp = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit]

not really a fan of the naming of this variable here lol.

...mockHostRegistration,
strRequirements: {
isBusinessLicenceRequired: false,
isPrincipalResidenceRequired: false,
isStrProhibited: false,
isStraaExempt: false,
organizationNm: 'City of Vancouver'
}
}

export const mockExpiredRegistration: HostRegistrationResp = {
...mockHostRegistration,
status: RegistrationStatus.EXPIRED,
Expand Down
28 changes: 28 additions & 0 deletions strr-examiner-web/tests/unit/registration-details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { mockNuxtImport, mountSuspended } from '@nuxt/test-utils/runtime'
import { describe, it, expect, vi, beforeAll } from 'vitest'
import {
mockHostRegistration,
mockHostRegistrationNotRequired,
mockPlatformRegistration,
mockStrataHotelRegistration,
mockExpiredRegistration,
Expand All @@ -15,6 +16,7 @@ import RegistrationDetails from '~/pages/registration/[registrationId]/index.vue
import {
DecisionPanel,
HistoricalApplicationsTable,
HostSupportingInfo,
RegistrationInfoHeader,
SnapshotVersionsTable,
SnapshotInfo
Expand Down Expand Up @@ -100,6 +102,32 @@ describe('Examiner - Registration Details Page', () => {
expect(wrapper.findComponent(RegistrationInfoHeader).exists()).toBe(true)
})

it('should show Required label in the PR section for registrations', () => {
const prSection = wrapper.findComponent(HostSupportingInfo).findTestId('pr-req-section')
expect(prSection.text()).toContain('Required')
})

it('should show Required label in the BL section for registrations', () => {
const blSection = wrapper.findComponent(HostSupportingInfo).findTestId('business-lic-section')
expect(blSection.text()).toContain('Required')
})

it('should show Not Required label in the PR section when isPrincipalResidenceRequired is false', async () => {
currentMockData = mockHostRegistrationNotRequired
const notRequiredWrapper = await mountSuspended(HostSupportingInfo, {
global: { plugins: [enI18n] }
})
expect(notRequiredWrapper.findTestId('pr-req-section').text()).toContain('Not Required')
})

it('should show Not Required label in the BL section when isBusinessLicenceRequired is false', async () => {
currentMockData = mockHostRegistrationNotRequired
const notRequiredWrapper = await mountSuspended(HostSupportingInfo, {
global: { plugins: [enI18n] }
})
expect(notRequiredWrapper.findTestId('business-lic-section').text()).toContain('Not Required')
})

it('displays correct badge color for ACTIVE status', async () => {
currentMockData = mockHostRegistration

Expand Down
Loading