Skip to content

Commit

Permalink
Merge pull request #728 from ArwenQin/22988-Fix-Amalgamation-Applicat…
Browse files Browse the repository at this point in the history
…ion-Bug

22988 - Fixed the Amalgamation Corp Type Bug
  • Loading branch information
ArwenQin authored Aug 27, 2024
2 parents 823a5f2 + fa402cb commit 2451488
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 47 deletions.
87 changes: 45 additions & 42 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-create-ui",
"version": "5.11.14",
"version": "5.11.15",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down Expand Up @@ -80,7 +80,6 @@
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@vitejs/plugin-vue2": "^2.2.0",
"@volar-plugins/vetur": "latest",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"@vue/test-utils": "^1.3.5",
Expand All @@ -96,6 +95,7 @@
"vite": "4.5.2",
"vite-plugin-environment": "^1.1.3",
"vitest": "0.33.0",
"volar-service-vetur": "^0.0.61",
"vue-class-component": "7.2.6",
"vue-property-decorator": "^9.1.2",
"vue-test-utils-helpers": "git+https://github.com/bcgov/vue-test-utils-helpers.git",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Amalgamation/ResultingBusinessName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default class ResultingBusinessName extends Mixins(AmalgamationMixin, Nam
(b.type === AmlTypes.LEAR && b.name === name)
)
if (business?.type === AmlTypes.LEAR) {
this.setEntityType(business.legalType)
this.setEntityType(this.getLegalType(business.legalType))
this.updateResources()
}
}
Expand All @@ -220,7 +220,7 @@ export default class ResultingBusinessName extends Mixins(AmalgamationMixin, Nam
// as we are using a new NR, also use its legal type
// and update resources (since legal type may have changed)
this.setEntityType(nameRequest.legalType)
this.setEntityType(this.getLegalType(nameRequest.legalType))
this.updateResources()
}
Expand Down
22 changes: 21 additions & 1 deletion src/mixins/amalgamation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export default class AmalgamationMixin extends Vue {
// set new resulting business name and legal type
// and update resources (since legal type may have changed)
this.setNameRequestApprovedName(business.name)
this.setEntityType(business.legalType)
this.setEntityType(this.getLegalType(business.legalType))
this.updateResources()
}

Expand Down Expand Up @@ -523,4 +523,24 @@ export default class AmalgamationMixin extends Vue {
get isAnyBcCompany (): boolean {
return (this.isAnyBen || this.isAnyCcc || this.isAnyLimited || this.isAnyUnlimited)
}

/** The legal type of the new amalgamation filing. */
getLegalType (legalType: CorpTypeCd): CorpTypeCd {
switch (legalType) {
case CorpTypeCd.CONTINUE_IN:
return CorpTypeCd.BC_COMPANY

case CorpTypeCd.BEN_CONTINUE_IN:
return CorpTypeCd.BENEFIT_COMPANY

case CorpTypeCd.CCC_CONTINUE_IN:
return CorpTypeCd.BC_CCC

case CorpTypeCd.ULC_CONTINUE_IN:
return CorpTypeCd.BC_ULC_COMPANY

default:
return legalType
}
}
}
21 changes: 21 additions & 0 deletions tests/unit/amalgamation-mixin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,25 @@ describe('Amalgamation Mixin - rules', () => {
store.setAmalgamationType(null)
expect(wrapper.vm.foreignHorizontal({ type: AmlTypes.FOREIGN })).toBeNull()
})

it('should set the correct entity type based on the primary company legal type', () => {
const setEntityTypeSpy = vi.spyOn(wrapper.vm, 'setEntityType')
const testCases = [
{ input: CorpTypeCd.CONTINUE_IN, expected: CorpTypeCd.BC_COMPANY },
{ input: CorpTypeCd.BEN_CONTINUE_IN, expected: CorpTypeCd.BENEFIT_COMPANY },
{ input: CorpTypeCd.CCC_CONTINUE_IN, expected: CorpTypeCd.BC_CCC },
{ input: CorpTypeCd.ULC_CONTINUE_IN, expected: CorpTypeCd.BC_ULC_COMPANY },
{ input: CorpTypeCd.BC_ULC_COMPANY, expected: CorpTypeCd.BC_ULC_COMPANY },
{ input: CorpTypeCd.BC_COMPANY, expected: CorpTypeCd.BC_COMPANY },
{ input: CorpTypeCd.BENEFIT_COMPANY, expected: CorpTypeCd.BENEFIT_COMPANY },
{ input: CorpTypeCd.BC_CCC, expected: CorpTypeCd.BC_CCC }
]
testCases.forEach(testCase => {
setEntityTypeSpy.mockClear()
const legalType = wrapper.vm.getLegalType(testCase.input)
wrapper.vm.setEntityType(legalType)
expect(setEntityTypeSpy).toHaveBeenCalledWith(testCase.expected)
})
setEntityTypeSpy.mockRestore()
})
})

0 comments on commit 2451488

Please sign in to comment.