From 1fa6099928bc8dbee61e9e2abde433709098d5ea Mon Sep 17 00:00:00 2001 From: Dima K Date: Tue, 14 May 2024 06:19:33 -0700 Subject: [PATCH] Reset Cancel Permit FF & Update tests (#1870) * Reset Cancel Permit Feature Flag * Fix Cancel Transport Permit tests --- ppr-ui/package-lock.json | 4 +-- ppr-ui/package.json | 2 +- ppr-ui/src/utils/feature-flags.ts | 2 +- ppr-ui/tests/unit/MhrTransportPermit.spec.ts | 35 ++++++++++++++++---- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index 36757fd20..73aaee9a6 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.1.20", + "version": "3.1.21", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.1.20", + "version": "3.1.21", "dependencies": { "@bcrs-shared-components/input-field-date-picker": "^1.0.0", "@lemoncode/fonk": "^1.5.1", diff --git a/ppr-ui/package.json b/ppr-ui/package.json index 4b52a9a65..3d02ae293 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "3.1.20", + "version": "3.1.21", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", diff --git a/ppr-ui/src/utils/feature-flags.ts b/ppr-ui/src/utils/feature-flags.ts index 4314e62fa..1aa7da15a 100644 --- a/ppr-ui/src/utils/feature-flags.ts +++ b/ppr-ui/src/utils/feature-flags.ts @@ -19,7 +19,7 @@ export const defaultFlagSet: LDFlagSet = { 'mhr-non-res-exemption-enabled': false, // Enables Non-Residential Exemption for Staff 'mhr-transport-permit-enabled': false, 'mhr-amend-transport-permit-enabled': false, - 'mhr-cancel-transport-permit-enabled': true, + 'mhr-cancel-transport-permit-enabled': false, 'mhr-user-access-enabled': false, 'sentry-enable': false, // by default, no sentry logs 'banner-text': '' // by default, there is no banner text diff --git a/ppr-ui/tests/unit/MhrTransportPermit.spec.ts b/ppr-ui/tests/unit/MhrTransportPermit.spec.ts index 9ce6d5fc5..057c36d4a 100644 --- a/ppr-ui/tests/unit/MhrTransportPermit.spec.ts +++ b/ppr-ui/tests/unit/MhrTransportPermit.spec.ts @@ -9,7 +9,7 @@ import { mockTransportPermitNewLocation, mockTransportPermitPreviousLocation, mo import { useStore } from '@/store/store' -import { AuthRoles, LocationChangeTypes, ProductCode, RouteNames } from '@/enums' +import { AuthRoles, HomeLocationTypes, LocationChangeTypes, ProductCode, RouteNames } from '@/enums' import { DocumentId, @@ -31,6 +31,7 @@ import { BaseDialog } from '@/components/dialogs' import { MhrInformation, MhrTransportPermit } from '@/views' import { useTransportPermits } from '@/composables' import { incompleteRegistrationDialog } from '@/resources/dialogOptions' +import { MhrRegistrationHomeLocationIF } from '@/interfaces' const store = useStore() @@ -778,15 +779,32 @@ describe('Mhr Information Transport Permit', async () => { defaultFlagSet['mhr-cancel-transport-permit-enabled'] = true wrapper.vm.dataLoaded = true + // setup current location to be cancelled + const location = {...mockTransportPermitNewLocation } + location.otherType = mockTransportPermitNewLocation.locationType + location.locationType = HomeLocationTypes.HOME_PARK + + await store.setMhrLocationAllFields(location) + await nextTick() + + wrapper = await createComponent( + MhrInformation, + { appReady: true, isMhrTransfer: false }, + RouteNames.MHR_INFORMATION + ) + wrapper.vm.dataLoaded = true + await setupActiveTransportPermit() - // set mhr registration location data for it to be prefilled in Cancelled Location section - const regLocation = store.getMhrRegistrationLocation - store.setMhrLocationAllFields({ ...regLocation, ...mockTransportPermitNewLocation }) + // setup previous location to restore + const previousLocation: MhrRegistrationHomeLocationIF = {...mockTransportPermitPreviousLocation} + previousLocation.otherType = mockTransportPermitPreviousLocation.locationType + previousLocation.locationType = HomeLocationTypes.OTHER_LAND + + await store.setMhrTransportPermitPreviousLocation(previousLocation) await nextTick() - // expect(wrapper.findByTestId('cancel-location-change-btn').text()).toBe('Cancel Transport Permit') - wrapper.findComponent(MhrTransportPermit).vm.handleCancelTransportPermit(true) + wrapper.findComponent(MhrTransportPermit).vm.toggleCancelTransportPermit(true) await nextTick() expect(wrapper.findByTestId('undo-transport-permit-cancellation-btn').exists()).toBeTruthy() @@ -799,11 +817,14 @@ describe('Mhr Information Transport Permit', async () => { const cancelledLocationSection = permitLocationSections[0] expect(cancelledLocationSection.find('label').text()).toContain('Cancelled Location') + expect(cancelledLocationSection.text()).toContain('Manufactured home park') + expect(cancelledLocationSection.text()).toContain(location.address.street) const restoredLocationSection = permitLocationSections[1] expect(restoredLocationSection.find('label').text()).toContain('Restored Location') expect(restoredLocationSection.text()).toContain(mockTransportPermitPreviousLocation.address.street) - expect(restoredLocationSection.text()).toContain(mockTransportPermitPreviousLocation.locationType) + expect(restoredLocationSection.text()).toContain('Strata') + expect(restoredLocationSection.text()).toContain(previousLocation.address.street) // transport permit details should not exist in Restored Location section expect(restoredLocationSection.findComponent(TransportPermitDetails).exists()).toBeFalsy()