diff --git a/package-lock.json b/package-lock.json index e2807ded..0845ee99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.11.14", + "version": "5.11.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.11.14", + "version": "5.11.15", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.0.19", @@ -75,7 +75,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", @@ -91,6 +90,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", @@ -1929,25 +1929,6 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, - "node_modules/@volar-plugins/vetur": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@volar-plugins/vetur/-/vetur-2.0.0.tgz", - "integrity": "sha512-RsubwRwnv497I8Dtru8gE/C6P+nmvmMLNnQnyLU3njTqO5Dm4KaBr6cbVl8iQOXHOxfBXzI3lmQSPWdsp3dXRA==", - "deprecated": "WARNING: This project has been renamed to volar-service-vetur. Install using volar-service-vetur instead.", - "dev": true, - "dependencies": { - "vls": "^0.8.2", - "vscode-html-languageservice": "^5.0.4" - }, - "peerDependencies": { - "@volar/language-service": "*" - }, - "peerDependenciesMeta": { - "@volar/language-service": { - "optional": true - } - } - }, "node_modules/@vscode/l10n": { "version": "0.0.18", "resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.18.tgz", @@ -6542,9 +6523,9 @@ "dev": true }, "node_modules/pug-error": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-2.0.0.tgz", - "integrity": "sha512-sjiUsi9M4RAGHktC1drQfCr5C5eriu24Lfbt4s+7SykztEOwVZtbFk1RRq0tzLxcMxMYTBR+zMQaG07J/btayQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-2.1.0.tgz", + "integrity": "sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==", "dev": true }, "node_modules/pug-lexer": { @@ -7736,6 +7717,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -8273,6 +8255,7 @@ "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", @@ -8287,12 +8270,13 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true }, "node_modules/vls/node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -8363,9 +8347,9 @@ } }, "node_modules/vls/node_modules/eslint-plugin-vue": { - "version": "9.25.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.25.0.tgz", - "integrity": "sha512-tDWlx14bVe6Bs+Nnh3IGrD+hb11kf2nukfm6jLsmJIhmiRQ1SUaksvwY9U5MvPB0pcrg0QK0xapQkfITs3RKOA==", + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.27.0.tgz", + "integrity": "sha512-5Dw3yxEyuBSXTzT5/Ge1X5kIkRTQ3nvBn/VwPwInNiZBSJOO/timWMUaflONnFBzU6NhB68lxnCda7ULV5N7LA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", @@ -8374,7 +8358,7 @@ "nth-check": "^2.1.1", "postcss-selector-parser": "^6.0.15", "semver": "^7.6.0", - "vue-eslint-parser": "^9.4.2", + "vue-eslint-parser": "^9.4.3", "xml-name-validator": "^4.0.0" }, "engines": { @@ -8451,9 +8435,9 @@ } }, "node_modules/vls/node_modules/vue-eslint-parser": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.2.tgz", - "integrity": "sha512-Ry9oiGmCAK91HrKMtCrKFWmSFWvYkpGglCeFAIqDdr9zdXmMMpJOmUJS7WWsW7fX81h6mwHmUZCQQ1E0PkSwYQ==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", + "integrity": "sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==", "dev": true, "dependencies": { "debug": "^4.3.4", @@ -8474,22 +8458,41 @@ "eslint": ">=6.0.0" } }, + "node_modules/volar-service-vetur": { + "version": "0.0.61", + "resolved": "https://registry.npmjs.org/volar-service-vetur/-/volar-service-vetur-0.0.61.tgz", + "integrity": "sha512-fThqfC/oFAQvKb0a5+82xQ6UxGLAjDz32saq+QLoX+GdOxn9LcbntGzZ+HGdh5NwAj5ZR/U7SnXDTII+UMtjmg==", + "dev": true, + "dependencies": { + "vls": "^0.8.5", + "vscode-html-languageservice": "^5.3.0", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "@volar/language-service": "~2.4.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, "node_modules/vscode-html-languageservice": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-5.2.0.tgz", - "integrity": "sha512-cdNMhyw57/SQzgUUGSIMQ66jikqEN6nBNyhx5YuOyj9310+eY9zw8Q0cXpiKzDX8aHYFewQEXRnigl06j/TVwQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-5.3.1.tgz", + "integrity": "sha512-ysUh4hFeW/WOWz/TO9gm08xigiSsV/FOAZ+DolgJfeLftna54YdmZ4A+lIn46RbdO3/Qv5QHTn1ZGqmrXQhZyA==", "dev": true, "dependencies": { "@vscode/l10n": "^0.0.18", - "vscode-languageserver-textdocument": "^1.0.11", + "vscode-languageserver-textdocument": "^1.0.12", "vscode-languageserver-types": "^3.17.5", "vscode-uri": "^3.0.8" } }, "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", - "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", "dev": true }, "node_modules/vscode-languageserver-types": { diff --git a/package.json b/package.json index f4708d5f..2ab88e63 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", diff --git a/src/components/Amalgamation/ResultingBusinessName.vue b/src/components/Amalgamation/ResultingBusinessName.vue index 5bbcb79e..955b033a 100644 --- a/src/components/Amalgamation/ResultingBusinessName.vue +++ b/src/components/Amalgamation/ResultingBusinessName.vue @@ -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() } } @@ -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() } diff --git a/src/mixins/amalgamation-mixin.ts b/src/mixins/amalgamation-mixin.ts index ca0d8887..846c4e22 100644 --- a/src/mixins/amalgamation-mixin.ts +++ b/src/mixins/amalgamation-mixin.ts @@ -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() } @@ -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 + } + } } diff --git a/tests/unit/amalgamation-mixin.spec.ts b/tests/unit/amalgamation-mixin.spec.ts index 7ac60548..4d28b27e 100644 --- a/tests/unit/amalgamation-mixin.spec.ts +++ b/tests/unit/amalgamation-mixin.spec.ts @@ -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() + }) })