Skip to content

Commit

Permalink
Reset Cancel Permit FF & Update tests (#1870)
Browse files Browse the repository at this point in the history
* Reset Cancel Permit Feature Flag
* Fix Cancel Transport Permit tests
  • Loading branch information
dimak1 authored May 14, 2024
1 parent d014fe0 commit 1fa6099
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.1.20",
"version": "3.1.21",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 28 additions & 7 deletions ppr-ui/tests/unit/MhrTransportPermit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()

Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 1fa6099

Please sign in to comment.