Skip to content

Commit

Permalink
20148 Updated to accommodate alternate name changes (#566)
Browse files Browse the repository at this point in the history
* Updated to accommodate alternate name changes

* updated package version

* fixed comment and tests

* changed to use nameTypes shared enum
  • Loading branch information
JazzarKarim authored Apr 3, 2024
1 parent 83caf36 commit 66f0f5f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-edit-ui",
"version": "5.0.1",
"version": "5.0.2",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand All @@ -27,7 +27,7 @@
"@bcrs-shared-components/court-order-poa": "2.1.3",
"@bcrs-shared-components/date-picker": "1.2.5",
"@bcrs-shared-components/detail-comment": "1.1.3",
"@bcrs-shared-components/enums": "1.0.46",
"@bcrs-shared-components/enums": "1.1.9",
"@bcrs-shared-components/fee-summary": "1.2.5",
"@bcrs-shared-components/folio-number": "1.1.1",
"@bcrs-shared-components/help-business-number": "1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export * from './routeNames'
// external enum
export { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/'
export { ActionTypes, ApprovalTypes, CorrectNameOptions, EntityStates, FilingCodes, FilingNames, FilingTypes,
RestorationTypes, RelationshipTypes } from '@bcrs-shared-components/enums'
NameTypes, RestorationTypes, RelationshipTypes } from '@bcrs-shared-components/enums'
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { CoopTypes } from '@/enums'
import { CoopTypes, NameTypes } from '@/enums'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/'
import { IsoDatePacific, ApiDateTimeUtc } from '@bcrs-shared-components/interfaces'

/** The Alternate Name (aka operating name) object. */
/** The Alternate Name object. */
export interface AlternateNameIF {
entityType: CorpTypeCd
identifier: string
name: string
nameRegisteredDate: ApiDateTimeUtc
nameStartDate: IsoDatePacific
operatingName: string
nameType: NameTypes
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ export const useStore = defineStore('store', {
return this.stateModel.tombstone.businessId
},

/** The original legal name (or operating name if this is a firm). */
/** The original legal name (or alternate name if this is a firm). */
getOriginalLegalName (): string {
if (this.isFirm) {
// return the operating name, if it exists
// return the alternate name, if it exists
const alternateNames = this.getOriginalBusinessInfo?.alternateNames || []
const alternateName = alternateNames.find(x => x.identifier === this.getBusinessId)
return alternateName?.operatingName || 'Unknown'
return alternateName?.name || 'Unknown'
}
return this.getOriginalBusinessInfo?.legalName || ''
},
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/EntityInfo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ describe('Entity Info component in a Correction as a numbered Benefit Company',
})

describe('Entity Info component for a firm', () => {
it('displays operating name correctly for a SP Change filing', () => {
it('displays alternate name correctly for a SP Change filing', () => {
const wrapper = shallowWrapperFactory(
EntityInfo,
null,
{
entitySnapshot: {
businessInfo: {
alternateNames: [
{ identifier: 'FM1234567', operatingName: 'My Operating Name' }
{ identifier: 'FM1234567', name: 'My Alternate Name' }
],
legalName: 'My Legal Name'
}
Expand All @@ -182,7 +182,7 @@ describe('Entity Info component for a firm', () => {
}
)

expect(wrapper.find('#entity-legal-name').text()).toBe('My Operating Name')
expect(wrapper.find('#entity-legal-name').text()).toBe('My Alternate Name')

wrapper.destroy()
})
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/filing-template-mixin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('Change of Registration Filing', () => {
addressCountry: 'CA'
}
}
store.stateModel.nameRequest.legalName = 'My Operating Name'
store.stateModel.nameRequest.legalName = 'My Alternate Name'
store.stateModel.entitySnapshot = {
businessInfo: {
foundingDate: 'Jan 01, 2000',
Expand All @@ -174,7 +174,7 @@ describe('Change of Registration Filing', () => {
alternateNames: [
{
identifier: 'FM1234567',
operatingName: 'My Operating Name'
name: 'My Alternate Name'
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/state-getters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ describe('SP/GP correction getters', () => {
store.stateModel.tombstone.entityType = CorpTypeCd.SOLE_PROP
store.stateModel.tombstone.filingType = FilingTypes.CORRECTION
store.stateModel.tombstone.businessId = 'FM1234567'
store.stateModel.nameRequest.legalName = 'My Operating Name'
store.stateModel.nameRequest.legalName = 'My Alternate Name'
store.stateModel.entitySnapshot = {
businessInfo: {
identifier: 'FM1234567',
Expand All @@ -436,7 +436,7 @@ describe('SP/GP correction getters', () => {
alternateNames: [
{
identifier: 'FM1234567',
operatingName: 'My Operating Name'
name: 'My Alternate Name'
}
]
},
Expand Down Expand Up @@ -468,7 +468,7 @@ describe('SP/GP correction getters', () => {
// verify that business name changes are detected
store.stateModel.nameRequest.legalName = 'MyLegalName2'
expect(vm.hasBusinessNameChanged).toBe(true)
store.stateModel.nameRequest.legalName = 'My Operating Name'
store.stateModel.nameRequest.legalName = 'My Alternate Name'
expect(vm.hasBusinessNameChanged).toBe(false)

// verify that business type changes are detected
Expand Down

0 comments on commit 66f0f5f

Please sign in to comment.