Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

19897 Fixed foreign jurisdiction region #661

Merged
merged 1 commit into from
Feb 20, 2024
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
4 changes: 2 additions & 2 deletions 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "5.9.5",
"version": "5.9.6",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
11 changes: 5 additions & 6 deletions src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ import { AmalgamationMixin, CommonMixin } from '@/mixins'
import { BusinessLookupServices } from '@/services'
import { BusinessLookup } from '@bcrs-shared-components/business-lookup'
import { Jurisdiction } from '@bcrs-shared-components/jurisdiction'
import { CanJurisdictions, MrasJurisdictions } from '@bcrs-shared-components/jurisdiction/list-data'
import { MrasJurisdictions } from '@bcrs-shared-components/jurisdiction/list-data'
import { AmalgamatingBusinessIF, BusinessLookupResultIF, EmptyBusinessLookup } from '@/interfaces'
import { AmlRoles, AmlTypes, EntityStates } from '@/enums'
import { JurisdictionLocation } from '@bcrs-shared-components/enums'
Expand Down Expand Up @@ -316,8 +316,8 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co
snackbar = false
snackbarText = ''
errorDialog = false
errorDialogText = undefined as string
errorDialogTitle = undefined as string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was actually causing some template errors. I originally had it this way so the default props would be used if we didn't specify them, but we always specify them anyway so '' is a better initial value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(From a high level, default prop values are normally used when you DON'T specify the prop at all. If we do specify the prop, but want to use its default value, then we'll have to set it to undefined. Neither of these applies here.)

errorDialogText = ''
errorDialogTitle = ''

// Foreign business properties
jurisdiction = null
Expand Down Expand Up @@ -418,12 +418,11 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co

// Special case to handle Extra Pro A companies
if ((businessLookup.legalType as any) === CorpTypeCd.EXTRA_PRO_A) {
const region = CanJurisdictions.find(jurisdiction => jurisdiction.value === JurisdictionLocation.BC)
const tingBusiness = {
type: AmlTypes.FOREIGN,
role: AmlRoles.AMALGAMATING,
foreignJurisdiction: {
region: region.text,
region: JurisdictionLocation.BC,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before:
image

After:
image

country: JurisdictionLocation.CA
},
legalName: businessLookup.name,
Expand Down Expand Up @@ -549,7 +548,7 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co
type: AmlTypes.FOREIGN,
role: AmlRoles.AMALGAMATING,
foreignJurisdiction: {
region: this.isCan ? this.jurisdiction.text : '',
region: this.isCan ? this.jurisdiction.value : '', // no region outside Canada
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before:
image

After:
image

country: this.isCan ? JurisdictionLocation.CA : this.jurisdiction.value
},
legalName: this.legalName,
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/AmalgamatingBusinesses.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('Amalgamating Businesses - add amalgamating business', () => {
const business = store.getAmalgamatingBusinesses[0] as any
expect(business.type).toBe(AmlTypes.FOREIGN)
expect(business.role).toBe(AmlRoles.AMALGAMATING)
expect(business.foreignJurisdiction).toEqual({ country: 'CA', region: 'British Columbia' })
expect(business.foreignJurisdiction).toEqual({ country: 'CA', region: 'BC' })
expect(business.legalName).toBe('Extra Pro Business')
expect(business.identifier).toBe('A1234567')

Expand Down Expand Up @@ -638,7 +638,7 @@ describe('Amalgamating Businesses - add amalgamating foreign business', () => {
// simulate form data
await wrapper.setData({
isCan: true,
jurisdiction: { text: 'BC', value: 'CA' },
jurisdiction: { text: 'Alberta', value: 'AB' },
Copy link
Collaborator Author

@severinbeauvais severinbeauvais Feb 20, 2024

Choose a reason for hiding this comment

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

This is what the jurisdiction object actually looks like when it's selected.

legalName: 'Foreign Business',
identifier: 'ABC-123'
})
Expand All @@ -654,7 +654,7 @@ describe('Amalgamating Businesses - add amalgamating foreign business', () => {
const business = store.getAmalgamatingBusinesses[0] as any
expect(business.type).toBe(AmlTypes.FOREIGN)
expect(business.role).toBe(AmlRoles.AMALGAMATING)
expect(business.foreignJurisdiction).toEqual({ country: 'CA', region: 'BC' })
expect(business.foreignJurisdiction).toEqual({ country: 'CA', region: 'AB' })
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed this from BC to AB since BC isn't "foreign" :)

expect(business.legalName).toBe('Foreign Business')
expect(business.identifier).toBe('ABC-123')

Expand All @@ -668,7 +668,7 @@ describe('Amalgamating Businesses - add amalgamating foreign business', () => {
{
type: AmlTypes.FOREIGN,
role: AmlRoles.AMALGAMATING,
foreignJurisdiction: { country: 'CA', region: 'British Columbia' },
foreignJurisdiction: { country: 'CA', region: 'AB' },
legalName: 'Foreign Business',
identifier: 'ABC-123'
}
Expand All @@ -681,7 +681,7 @@ describe('Amalgamating Businesses - add amalgamating foreign business', () => {
// simulate form data
await wrapper.setData({
isCan: true,
jurisdiction: { text: 'British Columbia', value: 'CA' },
jurisdiction: { text: 'Alberta', value: 'AB' },
legalName: 'Foreign Business',
identifier: 'ABC-123'
})
Expand Down
Loading