From 17acae0bd5dbf13b41623133a19aa85c25762576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Wed, 7 Dec 2022 17:05:53 -0800 Subject: [PATCH] 14529 Don't allow editing numbered company name (#429) * - filtered out Correct Name option for numbered company - renamed CorrectionTypes -> NameChangeOptions - app version = 3.9.6 * - added unit tests * - renamed resource files to resolve name conflicts - added Name Change Options test suite * - moved duplicate test logic into a single function --- package-lock.json | 4 +- package.json | 2 +- .../CompanyName/CorrectCompanyName.vue | 7 +- .../CompanyName/CorrectNameOptions.vue | 14 +- .../CompanyName/CorrectNameRequest.vue | 7 +- .../CompanyName/CorrectNameToNumber.vue | 7 +- .../common/YourCompany/YourCompany.vue | 12 +- ...orrectionTypes.ts => NameChangeOptions.ts} | 2 +- src/enums/index.ts | 2 +- .../correct-name-interface.ts | 4 +- .../resource-interfaces/resource-interface.ts | 4 +- .../{LimitedCompanyResource.ts => BC.ts} | 8 +- .../{BenefitCompanyResource.ts => BEN.ts} | 8 +- ...yContributionCompanyResource.ts => CCC.ts} | 8 +- ...itedLiabilityCompanyResource.ts => ULC.ts} | 8 +- src/resources/Alteration/index.ts | 8 +- .../{GeneralPartnershipResource.ts => GP.ts} | 6 +- .../{SoleProprietorshipResource.ts => SP.ts} | 6 +- src/resources/Change/index.ts | 4 +- .../{GeneralPartnershipResource.ts => GP.ts} | 6 +- .../{SoleProprietorshipResource.ts => SP.ts} | 6 +- src/resources/Conversion/index.ts | 4 +- .../Correction/{LimitedCompany.ts => BC.ts} | 8 +- .../Correction/{BenefitCompany.ts => BEN.ts} | 8 +- ...CommunityContributionCompany.ts => CCC.ts} | 8 +- .../{GeneralPartnership.ts => GP.ts} | 4 +- .../{SoleProprietorship.ts => SP.ts} | 4 +- .../{UnlimitedLiabilityCompany.ts => ULC.ts} | 8 +- src/resources/Correction/index.ts | 12 +- .../{Cooperative.ts => CP.ts} | 6 +- src/resources/SpecialResolution/index.ts | 2 +- src/store/getters/state-getters.ts | 7 +- src/utils/FilingTypeToName.ts | 5 +- src/views/Alteration.vue | 39 +-- src/views/Change.vue | 21 +- src/views/Conversion.vue | 21 +- src/views/Correction/BenCorrection.vue | 6 +- src/views/Correction/FmCorrection.vue | 6 +- src/views/SpecialResolution.vue | 44 ++-- tests/unit/ChangeSummary.spec.ts | 4 +- tests/unit/ConversionSummary.spec.ts | 4 +- tests/unit/CreateSpecialResolution.spec.ts | 6 +- tests/unit/FilingTypeToName.spec.ts | 1 + tests/unit/ListPeopleAndRoles.spec.ts | 4 +- tests/unit/NameChangeOptions.spec.ts | 244 ++++++++++++++++++ tests/unit/OfficeAddresses.spec.ts | 4 +- tests/unit/OrgPerson.spec.ts | 41 ++- tests/unit/PeopleAndRoles.spec.ts | 6 +- tests/unit/YourCompany.spec.ts | 38 +-- 49 files changed, 476 insertions(+), 222 deletions(-) rename src/enums/{correctionTypes.ts => NameChangeOptions.ts} (79%) rename src/resources/Alteration/{LimitedCompanyResource.ts => BC.ts} (78%) rename src/resources/Alteration/{BenefitCompanyResource.ts => BEN.ts} (78%) rename src/resources/Alteration/{CommunityContributionCompanyResource.ts => CCC.ts} (77%) rename src/resources/Alteration/{UnlimitedLiabilityCompanyResource.ts => ULC.ts} (78%) rename src/resources/Change/{GeneralPartnershipResource.ts => GP.ts} (90%) rename src/resources/Change/{SoleProprietorshipResource.ts => SP.ts} (90%) rename src/resources/Conversion/{GeneralPartnershipResource.ts => GP.ts} (88%) rename src/resources/Conversion/{SoleProprietorshipResource.ts => SP.ts} (88%) rename src/resources/Correction/{LimitedCompany.ts => BC.ts} (85%) rename src/resources/Correction/{BenefitCompany.ts => BEN.ts} (85%) rename src/resources/Correction/{CommunityContributionCompany.ts => CCC.ts} (85%) rename src/resources/Correction/{GeneralPartnership.ts => GP.ts} (92%) rename src/resources/Correction/{SoleProprietorship.ts => SP.ts} (92%) rename src/resources/Correction/{UnlimitedLiabilityCompany.ts => ULC.ts} (85%) rename src/resources/SpecialResolution/{Cooperative.ts => CP.ts} (91%) create mode 100644 tests/unit/NameChangeOptions.spec.ts diff --git a/package-lock.json b/package-lock.json index f00385176..27029810a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-edit-ui", - "version": "3.9.5", + "version": "3.9.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "business-edit-ui", - "version": "3.9.5", + "version": "3.9.6", "dependencies": { "@babel/compat-data": "^7.19.1", "@bcrs-shared-components/action-chip": "1.1.3", diff --git a/package.json b/package.json index 1d62ee236..582513ae9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-edit-ui", - "version": "3.9.5", + "version": "3.9.6", "private": true, "appName": "Edit UI", "sbcName": "SBC Common Components", diff --git a/src/components/common/YourCompany/CompanyName/CorrectCompanyName.vue b/src/components/common/YourCompany/CompanyName/CorrectCompanyName.vue index b49484c7c..0d597ca11 100644 --- a/src/components/common/YourCompany/CompanyName/CorrectCompanyName.vue +++ b/src/components/common/YourCompany/CompanyName/CorrectCompanyName.vue @@ -19,12 +19,12 @@ import { Component, Prop, Watch, Emit, Mixins } from 'vue-property-decorator' import { Action, Getter } from 'vuex-class' import { CommonMixin } from '@/mixins/' import { ActionBindingIF, NameRequestIF } from '@/interfaces/' -import { CorrectionTypes } from '@/enums/' +import { NameChangeOptions } from '@/enums/' @Component({}) export default class CorrectCompanyName extends Mixins(CommonMixin) { /** Form Submission Prop */ - @Prop({ default: null }) readonly formType!: CorrectionTypes + @Prop({ default: null }) readonly formType!: NameChangeOptions @Action setNameRequest!: ActionBindingIF @@ -54,7 +54,8 @@ export default class CorrectCompanyName extends Mixins(CommonMixin) { /** Watch for form submission and emit results. */ @Watch('formType') private onSubmit (): void { - if (this.formType === CorrectionTypes.CORRECT_NAME) { + // this component should only see correct-name form type + if (this.formType === NameChangeOptions.CORRECT_NAME) { // set the new company name this.setNameRequest({ ...this.getNameRequest, diff --git a/src/components/common/YourCompany/CompanyName/CorrectNameOptions.vue b/src/components/common/YourCompany/CompanyName/CorrectNameOptions.vue index 5073b803c..12cfa5525 100644 --- a/src/components/common/YourCompany/CompanyName/CorrectNameOptions.vue +++ b/src/components/common/YourCompany/CompanyName/CorrectNameOptions.vue @@ -58,7 +58,7 @@ import Vue from 'vue' import { Component, Emit, Prop } from 'vue-property-decorator' import { CorrectNameOptionIF } from '@/interfaces/' -import { CorrectionTypes } from '@/enums/' +import { NameChangeOptions } from '@/enums/' // for some reason, CorrectXXX cannot be imported from ./ // (it breaks a bunch of unit tests) @@ -85,27 +85,27 @@ export default class CorrectNameOptions extends Vue { // local properties protected displayedOptions: Array = [] protected panel: number = null - protected formType: CorrectionTypes = null - protected currentFormType: CorrectionTypes = null + protected formType: NameChangeOptions = null + protected currentFormType: NameChangeOptions = null protected isLoading = false protected isFormValid = false protected validateNameChange = false readonly correctionNameOptions: Array = [ { - id: CorrectionTypes.CORRECT_NAME, + id: NameChangeOptions.CORRECT_NAME, title: 'Edit the company name', description: 'Correct typographical errors in the existing company name.', component: CorrectCompanyName }, { - id: CorrectionTypes.CORRECT_NAME_TO_NUMBER, + id: NameChangeOptions.CORRECT_NAME_TO_NUMBER, title: 'Use the incorporation number as the name', description: null, component: CorrectNameToNumber }, { - id: CorrectionTypes.CORRECT_NEW_NR, + id: NameChangeOptions.CORRECT_NEW_NR, title: 'Use a new name request number', description: 'Enter the new Name Request Number (e.g., NR 1234567) and either the applicant phone number ' + 'OR the applicant email that was used when the name was requested.', @@ -139,7 +139,7 @@ export default class CorrectNameOptions extends Vue { } /** Identify the current form */ - protected identifyForm (type: CorrectionTypes) { + protected identifyForm (type: NameChangeOptions) { this.currentFormType = type this.isFormValid = false } diff --git a/src/components/common/YourCompany/CompanyName/CorrectNameRequest.vue b/src/components/common/YourCompany/CompanyName/CorrectNameRequest.vue index b8b0e385a..97891a628 100644 --- a/src/components/common/YourCompany/CompanyName/CorrectNameRequest.vue +++ b/src/components/common/YourCompany/CompanyName/CorrectNameRequest.vue @@ -66,7 +66,7 @@ import { Action, Getter } from 'vuex-class' import { ConfirmDialog as ConfirmDialogShared } from '@bcrs-shared-components/confirm-dialog/' import { CommonMixin, NameRequestMixin } from '@/mixins/' import { ActionBindingIF, ConfirmDialogType, NameRequestIF, NrCorrectionIF, NrResponseIF } from '@/interfaces/' -import { CorrectionTypes } from '@/enums/' +import { NameChangeOptions } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' @Component({ @@ -82,7 +82,7 @@ export default class CorrectNameRequest extends Mixins(CommonMixin, NameRequestM } /** The form type. */ - @Prop({ default: null }) readonly formType!: CorrectionTypes + @Prop({ default: null }) readonly formType!: NameChangeOptions /** Whether to perform validation. */ @Prop({ default: false }) readonly validate!: boolean @@ -147,7 +147,8 @@ export default class CorrectNameRequest extends Mixins(CommonMixin, NameRequestM /** Watch for form submission and emit results. */ @Watch('formType') private async onSubmit (): Promise { - if (this.formType === CorrectionTypes.CORRECT_NEW_NR) { + // this component should only see correct-new-nr form type + if (this.formType === NameChangeOptions.CORRECT_NEW_NR) { try { // Validate and return the name request data const nr: NrResponseIF = await this.validateNameRequest( diff --git a/src/components/common/YourCompany/CompanyName/CorrectNameToNumber.vue b/src/components/common/YourCompany/CompanyName/CorrectNameToNumber.vue index 778b95d0d..1632de382 100644 --- a/src/components/common/YourCompany/CompanyName/CorrectNameToNumber.vue +++ b/src/components/common/YourCompany/CompanyName/CorrectNameToNumber.vue @@ -21,12 +21,12 @@ import { Action, Getter } from 'vuex-class' // Interfaces && enums import { ActionBindingIF, NameRequestIF } from '@/interfaces/' -import { CorrectionTypes } from '@/enums/' +import { NameChangeOptions } from '@/enums/' @Component({}) export default class CorrectNameToNumber extends Vue { /** Form Submission Prop */ - @Prop({ default: null }) readonly formType!: CorrectionTypes + @Prop({ default: null }) readonly formType!: NameChangeOptions @Action setNameRequest!: ActionBindingIF @@ -43,7 +43,8 @@ export default class CorrectNameToNumber extends Vue { /** Watch for form submission and emit results. */ @Watch('formType') private async onSubmit (): Promise { - if (this.formType === CorrectionTypes.CORRECT_NAME_TO_NUMBER) { + // this component should only see correct-name-to-number form type + if (this.formType === NameChangeOptions.CORRECT_NAME_TO_NUMBER) { // delete the current legal name and NR number this.setNameRequest({ ...this.getNameRequest, diff --git a/src/components/common/YourCompany/YourCompany.vue b/src/components/common/YourCompany/YourCompany.vue index 4c29d4294..1c43ed77f 100644 --- a/src/components/common/YourCompany/YourCompany.vue +++ b/src/components/common/YourCompany/YourCompany.vue @@ -314,7 +314,7 @@ import { ContactPointIF } from '@bcrs-shared-components/interfaces/' import { AssociationType, BusinessContactInfo, ChangeBusinessType, FolioInformation, CorrectNameOptions, NameTranslation, NatureOfBusiness, OfficeAddresses, BusinessStartDate } from './' import { CommonMixin, DateMixin, NameRequestMixin } from '@/mixins/' -import { CoopTypes, CorrectionTypes } from '@/enums/' +import { CoopTypes, NameChangeOptions } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ConversionNOB } from '@/components/Conversion' @@ -488,11 +488,13 @@ export default class YourCompany extends Mixins( } /** The current options for change of name correction or edit. */ - get nameChangeOptions (): Array { - // remove name-to-numbered-company option when already a numbered company + get nameChangeOptions (): Array { + // if this is a numbered company, remove correct-name and name-to-number options if (this.isNumberedCompany) { - return this.getResource.changeData.nameChangeOptions - .filter(option => option !== CorrectionTypes.CORRECT_NAME_TO_NUMBER) + return this.getResource.changeData.nameChangeOptions.filter(option => ( + option !== NameChangeOptions.CORRECT_NAME && + option !== NameChangeOptions.CORRECT_NAME_TO_NUMBER + )) } return this.getResource.changeData.nameChangeOptions } diff --git a/src/enums/correctionTypes.ts b/src/enums/NameChangeOptions.ts similarity index 79% rename from src/enums/correctionTypes.ts rename to src/enums/NameChangeOptions.ts index 0dd634316..6afd1b653 100644 --- a/src/enums/correctionTypes.ts +++ b/src/enums/NameChangeOptions.ts @@ -1,4 +1,4 @@ -export enum CorrectionTypes { +export enum NameChangeOptions { CORRECT_NAME = 'correct-name', CORRECT_NAME_TO_NUMBER = 'correct-name-to-number', CORRECT_NEW_NR = 'correct-new-nr' diff --git a/src/enums/index.ts b/src/enums/index.ts index 32126ecc3..8a2bcca34 100644 --- a/src/enums/index.ts +++ b/src/enums/index.ts @@ -4,7 +4,6 @@ export * from './compareModes' export * from './componentsCompanyInfo' export * from './componentsReviewCertify' export * from './correctionErrorTypes' -export * from './correctionTypes' export * from './effectiveDateTypes' export * from './effectOfOrders' export * from './entitySubtypes' @@ -13,6 +12,7 @@ export * from './filingNames' export * from './filingStatus' export * from './filingTypes' export * from './partyTypes' +export * from './NameChangeOptions' export * from './nameRequestStates' export * from './nameRequestTypes' export * from './roleTypes' diff --git a/src/interfaces/correction-interfaces/correct-name-interface.ts b/src/interfaces/correction-interfaces/correct-name-interface.ts index df033a7b1..a9ea1215b 100644 --- a/src/interfaces/correction-interfaces/correct-name-interface.ts +++ b/src/interfaces/correction-interfaces/correct-name-interface.ts @@ -1,9 +1,9 @@ import { NameRequestApplicantIF } from '@/interfaces/' -import { CorrectionTypes, NameRequestStates, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, NameRequestStates, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' export interface CorrectNameOptionIF { - id: CorrectionTypes, + id: NameChangeOptions, title: string, description?: string, component: any diff --git a/src/interfaces/resource-interfaces/resource-interface.ts b/src/interfaces/resource-interfaces/resource-interface.ts index 613524e61..145014121 100644 --- a/src/interfaces/resource-interfaces/resource-interface.ts +++ b/src/interfaces/resource-interfaces/resource-interface.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { HelpSectionIF, FilingDataIF, SpecialResolutionSampleFormIF } from '@/interfaces/' @@ -13,7 +13,7 @@ export interface ResourceIF { description?: string // BEN corrections only filingData: FilingDataIF changeData?: { - nameChangeOptions?: Array + nameChangeOptions?: Array typeChangeInfo?: string orgPersonInfo?: { orgPersonLabel: string diff --git a/src/resources/Alteration/LimitedCompanyResource.ts b/src/resources/Alteration/BC.ts similarity index 78% rename from src/resources/Alteration/LimitedCompanyResource.ts rename to src/resources/Alteration/BC.ts index 5685b3d2f..9da1b3c6c 100644 --- a/src/resources/Alteration/LimitedCompanyResource.ts +++ b/src/resources/Alteration/BC.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const LimitedCompanyResource: ResourceIF = { +export const BcAlterationResource: ResourceIF = { entityReference: 'Company', contactLabel: 'Registered Office', displayName: GetCorpFullDescription(CorpTypeCd.BC_COMPANY), @@ -14,8 +14,8 @@ export const LimitedCompanyResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER ] }, certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' + diff --git a/src/resources/Alteration/BenefitCompanyResource.ts b/src/resources/Alteration/BEN.ts similarity index 78% rename from src/resources/Alteration/BenefitCompanyResource.ts rename to src/resources/Alteration/BEN.ts index 72b353c94..9062810c6 100644 --- a/src/resources/Alteration/BenefitCompanyResource.ts +++ b/src/resources/Alteration/BEN.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const BenefitCompanyResource: ResourceIF = { +export const BenAlterationResource: ResourceIF = { entityReference: 'Company', contactLabel: 'Registered Office', displayName: GetCorpFullDescription(CorpTypeCd.BENEFIT_COMPANY), @@ -14,8 +14,8 @@ export const BenefitCompanyResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER ] }, certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' + diff --git a/src/resources/Alteration/CommunityContributionCompanyResource.ts b/src/resources/Alteration/CCC.ts similarity index 77% rename from src/resources/Alteration/CommunityContributionCompanyResource.ts rename to src/resources/Alteration/CCC.ts index c5d863a23..0b86f1369 100644 --- a/src/resources/Alteration/CommunityContributionCompanyResource.ts +++ b/src/resources/Alteration/CCC.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const CommunityContributionCompanyResource: ResourceIF = { +export const CccAlterationResource: ResourceIF = { entityReference: 'Company', contactLabel: 'Registered Office', displayName: GetCorpFullDescription(CorpTypeCd.BC_CCC), @@ -14,8 +14,8 @@ export const CommunityContributionCompanyResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER ] }, certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' + diff --git a/src/resources/Alteration/UnlimitedLiabilityCompanyResource.ts b/src/resources/Alteration/ULC.ts similarity index 78% rename from src/resources/Alteration/UnlimitedLiabilityCompanyResource.ts rename to src/resources/Alteration/ULC.ts index 4dac5bd2f..bf7c9c0c7 100644 --- a/src/resources/Alteration/UnlimitedLiabilityCompanyResource.ts +++ b/src/resources/Alteration/ULC.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const UnlimitedLiabilityCompanyResource: ResourceIF = { +export const UlcAlterationResource: ResourceIF = { entityReference: 'Company', contactLabel: 'Registered Office', displayName: GetCorpFullDescription(CorpTypeCd.BC_ULC_COMPANY), @@ -14,8 +14,8 @@ export const UnlimitedLiabilityCompanyResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER ] }, certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' + diff --git a/src/resources/Alteration/index.ts b/src/resources/Alteration/index.ts index d8015464a..af281564f 100644 --- a/src/resources/Alteration/index.ts +++ b/src/resources/Alteration/index.ts @@ -1,4 +1,4 @@ -export * from './BenefitCompanyResource' -export * from './LimitedCompanyResource' -export * from './CommunityContributionCompanyResource' -export * from './UnlimitedLiabilityCompanyResource' +export * from './BC' +export * from './BEN' +export * from './CCC' +export * from './ULC' diff --git a/src/resources/Change/GeneralPartnershipResource.ts b/src/resources/Change/GP.ts similarity index 90% rename from src/resources/Change/GeneralPartnershipResource.ts rename to src/resources/Change/GP.ts index 2a8398b85..97835cbed 100644 --- a/src/resources/Change/GeneralPartnershipResource.ts +++ b/src/resources/Change/GP.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const GeneralPartnershipResource: ResourceIF = { +export const GpChangeResource: ResourceIF = { entityReference: 'Business', contactLabel: 'Business', displayName: GetCorpFullDescription(CorpTypeCd.PARTNERSHIP), @@ -14,7 +14,7 @@ export const GeneralPartnershipResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'General Partnership cannot be changed into a Sole Proprietorship. If this is necessary, a new ' + 'Name Request Number and Statement of Registration (along with associated fees) will be required.', diff --git a/src/resources/Change/SoleProprietorshipResource.ts b/src/resources/Change/SP.ts similarity index 90% rename from src/resources/Change/SoleProprietorshipResource.ts rename to src/resources/Change/SP.ts index 309f9d4b9..d72050b29 100644 --- a/src/resources/Change/SoleProprietorshipResource.ts +++ b/src/resources/Change/SP.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const SoleProprietorshipResource: ResourceIF = { +export const SpChangeResource: ResourceIF = { entityReference: 'Business', contactLabel: 'Business', displayName: GetCorpFullDescription(CorpTypeCd.SOLE_PROP), @@ -14,7 +14,7 @@ export const SoleProprietorshipResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'You cannot change the business type of a Sole Proprietorship / DBA. You must form a new ' + 'business and dissolve this business once the new business is registered.', diff --git a/src/resources/Change/index.ts b/src/resources/Change/index.ts index 39588bd86..813055c8b 100644 --- a/src/resources/Change/index.ts +++ b/src/resources/Change/index.ts @@ -1,2 +1,2 @@ -export * from './GeneralPartnershipResource' -export * from './SoleProprietorshipResource' +export * from './GP' +export * from './SP' diff --git a/src/resources/Conversion/GeneralPartnershipResource.ts b/src/resources/Conversion/GP.ts similarity index 88% rename from src/resources/Conversion/GeneralPartnershipResource.ts rename to src/resources/Conversion/GP.ts index c27257acb..b1102475b 100644 --- a/src/resources/Conversion/GeneralPartnershipResource.ts +++ b/src/resources/Conversion/GP.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const GeneralPartnershipResource: ResourceIF = { +export const GpConversionResource: ResourceIF = { entityReference: 'Business', contactLabel: 'Business', displayName: GetCorpFullDescription(CorpTypeCd.PARTNERSHIP), @@ -15,7 +15,7 @@ export const GeneralPartnershipResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'General Partnership cannot be changed into a Sole Proprietorship. If this is necessary, a new ' + 'Name Request Number and Statement of Registration (along with associated fees) will be required.', diff --git a/src/resources/Conversion/SoleProprietorshipResource.ts b/src/resources/Conversion/SP.ts similarity index 88% rename from src/resources/Conversion/SoleProprietorshipResource.ts rename to src/resources/Conversion/SP.ts index f44b4ed16..ed9f10530 100644 --- a/src/resources/Conversion/SoleProprietorshipResource.ts +++ b/src/resources/Conversion/SP.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes } from '@/enums/' +import { NameChangeOptions, FilingCodes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const SoleProprietorshipResource: ResourceIF = { +export const SpConversionResource: ResourceIF = { entityReference: 'Business', contactLabel: 'Business', displayName: GetCorpFullDescription(CorpTypeCd.SOLE_PROP), @@ -15,7 +15,7 @@ export const SoleProprietorshipResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'You cannot change the business type of a Sole Proprietorship / DBA. You must form a new ' + 'business and dissolve this business once the new business is registered.', diff --git a/src/resources/Conversion/index.ts b/src/resources/Conversion/index.ts index 39588bd86..813055c8b 100644 --- a/src/resources/Conversion/index.ts +++ b/src/resources/Conversion/index.ts @@ -1,2 +1,2 @@ -export * from './GeneralPartnershipResource' -export * from './SoleProprietorshipResource' +export * from './GP' +export * from './SP' diff --git a/src/resources/Correction/LimitedCompany.ts b/src/resources/Correction/BC.ts similarity index 85% rename from src/resources/Correction/LimitedCompany.ts rename to src/resources/Correction/BC.ts index baf2ae9dd..f2882277d 100644 --- a/src/resources/Correction/LimitedCompany.ts +++ b/src/resources/Correction/BC.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -18,9 +18,9 @@ export const BcCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER, - CorrectionTypes.CORRECT_NAME + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER, + NameChangeOptions.CORRECT_NAME ], orgPersonInfo: { orgPersonLabel: 'Directors', diff --git a/src/resources/Correction/BenefitCompany.ts b/src/resources/Correction/BEN.ts similarity index 85% rename from src/resources/Correction/BenefitCompany.ts rename to src/resources/Correction/BEN.ts index b96a47a44..8c2d5f642 100644 --- a/src/resources/Correction/BenefitCompany.ts +++ b/src/resources/Correction/BEN.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -18,9 +18,9 @@ export const BenCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER, - CorrectionTypes.CORRECT_NAME + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER, + NameChangeOptions.CORRECT_NAME ], orgPersonInfo: { orgPersonLabel: 'Directors', diff --git a/src/resources/Correction/CommunityContributionCompany.ts b/src/resources/Correction/CCC.ts similarity index 85% rename from src/resources/Correction/CommunityContributionCompany.ts rename to src/resources/Correction/CCC.ts index cc2b5d1f4..a81781562 100644 --- a/src/resources/Correction/CommunityContributionCompany.ts +++ b/src/resources/Correction/CCC.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -18,9 +18,9 @@ export const CccCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER, - CorrectionTypes.CORRECT_NAME + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER, + NameChangeOptions.CORRECT_NAME ], orgPersonInfo: { orgPersonLabel: 'Directors', diff --git a/src/resources/Correction/GeneralPartnership.ts b/src/resources/Correction/GP.ts similarity index 92% rename from src/resources/Correction/GeneralPartnership.ts rename to src/resources/Correction/GP.ts index 7b15c6c62..fd24999d7 100644 --- a/src/resources/Correction/GeneralPartnership.ts +++ b/src/resources/Correction/GP.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -15,7 +15,7 @@ export const GpCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'General Partnership cannot be changed into a Sole Proprietorship. If this is necessary, a new ' + 'Name Request Number and Statement of Registration (along with associated fees) will be required.', diff --git a/src/resources/Correction/SoleProprietorship.ts b/src/resources/Correction/SP.ts similarity index 92% rename from src/resources/Correction/SoleProprietorship.ts rename to src/resources/Correction/SP.ts index e7bc8b15a..feb49e0d6 100644 --- a/src/resources/Correction/SoleProprietorship.ts +++ b/src/resources/Correction/SP.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -15,7 +15,7 @@ export const SpCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'You cannot change the business type of a Sole Proprietorship / DBA. You must form a new ' + 'business and dissolve this business once the new business is registered.', diff --git a/src/resources/Correction/UnlimitedLiabilityCompany.ts b/src/resources/Correction/ULC.ts similarity index 85% rename from src/resources/Correction/UnlimitedLiabilityCompany.ts rename to src/resources/Correction/ULC.ts index 55e60ee48..42881539c 100644 --- a/src/resources/Correction/UnlimitedLiabilityCompany.ts +++ b/src/resources/Correction/ULC.ts @@ -1,4 +1,4 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' @@ -18,9 +18,9 @@ export const UlcCorrectionResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR, - CorrectionTypes.CORRECT_NAME_TO_NUMBER, - CorrectionTypes.CORRECT_NAME + NameChangeOptions.CORRECT_NEW_NR, + NameChangeOptions.CORRECT_NAME_TO_NUMBER, + NameChangeOptions.CORRECT_NAME ], orgPersonInfo: { orgPersonLabel: 'Directors', diff --git a/src/resources/Correction/index.ts b/src/resources/Correction/index.ts index 1649e3bf1..893909904 100644 --- a/src/resources/Correction/index.ts +++ b/src/resources/Correction/index.ts @@ -1,6 +1,6 @@ -export * from './BenefitCompany' -export * from './CommunityContributionCompany' -export * from './GeneralPartnership' -export * from './LimitedCompany' -export * from './SoleProprietorship' -export * from './UnlimitedLiabilityCompany' +export * from './BC' +export * from './BEN' +export * from './CCC' +export * from './GP' +export * from './SP' +export * from './ULC' diff --git a/src/resources/SpecialResolution/Cooperative.ts b/src/resources/SpecialResolution/CP.ts similarity index 91% rename from src/resources/SpecialResolution/Cooperative.ts rename to src/resources/SpecialResolution/CP.ts index 4d4f5e18a..3c86b5d5c 100644 --- a/src/resources/SpecialResolution/Cooperative.ts +++ b/src/resources/SpecialResolution/CP.ts @@ -1,8 +1,8 @@ -import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/' +import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' import { ResourceIF } from '@/interfaces/' -export const CooperativeResource: ResourceIF = { +export const CpSpecialResolutionResource: ResourceIF = { entityReference: 'Business', contactLabel: 'Registered Office', displayName: GetCorpFullDescription(CorpTypeCd.COOP), @@ -14,7 +14,7 @@ export const CooperativeResource: ResourceIF = { }, changeData: { nameChangeOptions: [ - CorrectionTypes.CORRECT_NEW_NR + NameChangeOptions.CORRECT_NEW_NR ], typeChangeInfo: 'You cannot change the business type of a Cooperative Association. You must form a new' + 'business and dissolve this business once the new business is registered.', diff --git a/src/resources/SpecialResolution/index.ts b/src/resources/SpecialResolution/index.ts index 9464cef84..beb90c24c 100644 --- a/src/resources/SpecialResolution/index.ts +++ b/src/resources/SpecialResolution/index.ts @@ -1 +1 @@ -export * from './Cooperative' +export * from './CP' diff --git a/src/store/getters/state-getters.ts b/src/store/getters/state-getters.ts index 2633aeb49..82037a559 100644 --- a/src/store/getters/state-getters.ts +++ b/src/store/getters/state-getters.ts @@ -1,8 +1,7 @@ -import { AccountTypes, ActionTypes, CoopTypes, CorrectionErrorTypes, FilingCodes, FilingNames, - FilingTypes, PartyTypes } from '@/enums/' +import { AccountTypes, ActionTypes, CoopTypes, CorrectionErrorTypes, FilingNames, FilingTypes, + PartyTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' -import { AddressesIF, OrgPersonIF, ShareClassIF, NameRequestIF, BusinessInformationIF, - CertifyIF, +import { AddressesIF, OrgPersonIF, ShareClassIF, NameRequestIF, BusinessInformationIF, CertifyIF, NameTranslationIF, FilingDataIF, StateIF, EffectiveDateTimeIF, FlagsReviewCertifyIF, FlagsCompanyInfoIF, ResolutionsIF, FeesIF, ResourceIF, EntitySnapshotIF, ValidationFlagsIF, CorrectionInformationIF } diff --git a/src/utils/FilingTypeToName.ts b/src/utils/FilingTypeToName.ts index 969ca1369..df1282910 100644 --- a/src/utils/FilingTypeToName.ts +++ b/src/utils/FilingTypeToName.ts @@ -19,8 +19,7 @@ export function FilingTypeToName (type: FilingTypes): string { case FilingTypes.CORRECTION: return FilingNames.CORRECTION case FilingTypes.INCORPORATION_APPLICATION: return FilingNames.INCORPORATION_APPLICATION case FilingTypes.REGISTRATION: return FilingNames.REGISTRATION + case FilingTypes.SPECIAL_RESOLUTION: return FilingNames.SPECIAL_RESOLUTION + default: return CamelCaseToWords(type) // fallback for unknown filings } - - // fallback for unknown filings - return CamelCaseToWords(type) } diff --git a/src/views/Alteration.vue b/src/views/Alteration.vue index 02f86f49f..14529c324 100644 --- a/src/views/Alteration.vue +++ b/src/views/Alteration.vue @@ -121,8 +121,8 @@ import { ActionBindingIF, EntitySnapshotIF, FlagsReviewCertifyIF, ResourceIF } from '@/interfaces/' import { FilingStatus } from '@/enums/' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' -import { BenefitCompanyResource, LimitedCompanyResource, CommunityContributionCompanyResource, - UnlimitedLiabilityCompanyResource } from '@/resources/Alteration/' +import { BcAlterationResource, BenAlterationResource, CccAlterationResource, UlcAlterationResource } + from '@/resources/Alteration/' @Component({ components: { @@ -179,10 +179,12 @@ export default class Alteration extends Mixins( /** The resource file for an alteration filing. */ get alterationResource (): ResourceIF { - if (this.isEntityTypeBEN) return BenefitCompanyResource - if (this.isEntityTypeBC) return LimitedCompanyResource - if (this.isEntityTypeCCC) return CommunityContributionCompanyResource - if (this.isEntityTypeULC) return UnlimitedLiabilityCompanyResource + switch (true) { + case this.isEntityTypeBC: return BcAlterationResource + case this.isEntityTypeBEN: return BenAlterationResource + case this.isEntityTypeCCC: return CccAlterationResource + case this.isEntityTypeULC: return UlcAlterationResource + } return null } @@ -232,21 +234,20 @@ export default class Alteration extends Mixins( this.parseEntitySnapshot(entitySnapshot) } - if (this.alterationResource) { - // set the specific resource - this.setResource(this.alterationResource) - - // initialize Fee Summary data - const filingData = [this.alterationResource.filingData] - filingData.forEach(fd => { - fd.futureEffective = this.getEffectiveDateTime.isFutureEffective - }) - this.setFilingData(filingData) - } else { - // go to catch() - throw new Error(`Invalid Alteration resources entity type = ${this.getEntityType}`) + if (!this.alterationResource) { + throw new Error(`Invalid alteration resource entity type = ${this.getEntityType}`) } + // set the specific resource + this.setResource(this.alterationResource) + + // initialize Fee Summary data + const filingData = [this.alterationResource.filingData] + filingData.forEach(fd => { + fd.futureEffective = this.getEffectiveDateTime.isFutureEffective + }) + this.setFilingData(filingData) + // update the current fees for the Filing await this.setCurrentFeesFromFilingData(this.getEffectiveDateTime.isFutureEffective) diff --git a/src/views/Change.vue b/src/views/Change.vue index 5d1870026..9ae074cad 100644 --- a/src/views/Change.vue +++ b/src/views/Change.vue @@ -95,7 +95,7 @@ import { CommonMixin, FeeMixin, FilingTemplateMixin } from '@/mixins/' import { ActionBindingIF, EntitySnapshotIF, ResourceIF } from '@/interfaces/' import { FilingStatus } from '@/enums/' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' -import { SoleProprietorshipResource, GeneralPartnershipResource } from '@/resources/Change/' +import { SpChangeResource, GpChangeResource } from '@/resources/Change/' @Component({ components: { @@ -152,8 +152,8 @@ export default class Change extends Mixins( /** The resource file for a firm change filing. */ get firmChangeResource (): ResourceIF { - if (this.isEntityTypeSP) return SoleProprietorshipResource - if (this.isEntityTypeGP) return GeneralPartnershipResource + if (this.isEntityTypeSP) return SpChangeResource + if (this.isEntityTypeGP) return GpChangeResource return null } @@ -203,17 +203,16 @@ export default class Change extends Mixins( this.parseEntitySnapshot(entitySnapshot) } - if (this.firmChangeResource) { - // set the specific resource - this.setResource(this.firmChangeResource) - - // initialize Fee Summary data - this.setFilingData([this.firmChangeResource.filingData]) - } else { - // go to catch() + if (!this.firmChangeResource) { throw new Error(`Invalid change resource entity type = ${this.getEntityType}`) } + // set the specific resource + this.setResource(this.firmChangeResource) + + // initialize Fee Summary data + this.setFilingData([this.firmChangeResource.filingData]) + // update the current fees for the Filing await this.setCurrentFeesFromFilingData() diff --git a/src/views/Conversion.vue b/src/views/Conversion.vue index fed7be837..800d66e0a 100644 --- a/src/views/Conversion.vue +++ b/src/views/Conversion.vue @@ -57,7 +57,7 @@ import { CommonMixin, FeeMixin, FilingTemplateMixin } from '@/mixins/' import { ActionBindingIF, EntitySnapshotIF } from '@/interfaces/' import { FilingStatus } from '@/enums/' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' -import { SoleProprietorshipResource, GeneralPartnershipResource } from '@/resources/Conversion/' +import { SpConversionResource, GpConversionResource } from '@/resources/Conversion/' import { ConversionSummary } from '@/components/Conversion' import { StatusCodes } from 'http-status-codes' @@ -101,8 +101,8 @@ export default class Conversion extends Mixins( /** The resource file for a firm conversion filing. */ get firmConversionResource (): any { - if (this.isEntityTypeSP) return SoleProprietorshipResource - if (this.isEntityTypeGP) return GeneralPartnershipResource + if (this.isEntityTypeSP) return SpConversionResource + if (this.isEntityTypeGP) return GpConversionResource return null } @@ -160,17 +160,16 @@ export default class Conversion extends Mixins( this.parseEntitySnapshot(entitySnapshot) } - if (this.firmConversionResource) { - // set the specific resource - this.setResource(this.firmConversionResource) - - // initialize Fee Summary data - this.setFilingData([this.firmConversionResource.filingData]) - } else { - // go to catch() + if (!this.firmConversionResource) { throw new Error(`Invalid conversion resource entity type = ${this.getEntityType}`) } + // set the specific resource + this.setResource(this.firmConversionResource) + + // initialize Fee Summary data + this.setFilingData([this.firmConversionResource.filingData]) + // update the current fees for the Filing await this.setCurrentFeesFromFilingData() diff --git a/src/views/Correction/BenCorrection.vue b/src/views/Correction/BenCorrection.vue index 333f613fc..fe24d605b 100644 --- a/src/views/Correction/BenCorrection.vue +++ b/src/views/Correction/BenCorrection.vue @@ -105,7 +105,7 @@ export default class BenCorrection extends Mixins(CommonMixin, DateMixin, FeeMix case this.isEntityTypeCCC: return CccCorrectionResource case this.isEntityTypeULC: return UlcCorrectionResource } - throw new Error(`Invalid Correction Resource entity type = ${this.getEntityType}`) + return null } /** @@ -125,6 +125,10 @@ export default class BenCorrection extends Mixins(CommonMixin, DateMixin, FeeMix // parse draft correction filing and entity snapshot into store this.parseCorrectionFiling(this.correctionFiling, entitySnapshot) + if (!this.correctionResource) { + throw new Error(`Invalid correction resource entity type = ${this.getEntityType}`) + } + // set the resources this.setResource(this.correctionResource) diff --git a/src/views/Correction/FmCorrection.vue b/src/views/Correction/FmCorrection.vue index 81ba910f4..b125d5bdf 100644 --- a/src/views/Correction/FmCorrection.vue +++ b/src/views/Correction/FmCorrection.vue @@ -69,7 +69,7 @@ export default class FmCorrection extends Mixins(CommonMixin, FeeMixin, FilingTe get correctionResource (): ResourceIF { if (this.isEntityTypeSP) return SpCorrectionResource if (this.isEntityTypeGP) return GpCorrectionResource - throw new Error(`Invalid Correction Resource entity type = ${this.getEntityType}`) + return null } /** @@ -89,6 +89,10 @@ export default class FmCorrection extends Mixins(CommonMixin, FeeMixin, FilingTe // parse draft correction filing and entity snapshot into store this.parseCorrectionFiling(this.correctionFiling, entitySnapshot) + if (!this.correctionResource) { + throw new Error(`Invalid correction resource entity type = ${this.getEntityType}`) + } + // set the resources this.setResource(this.correctionResource) diff --git a/src/views/SpecialResolution.vue b/src/views/SpecialResolution.vue index 612a572d1..a5bd03dbe 100644 --- a/src/views/SpecialResolution.vue +++ b/src/views/SpecialResolution.vue @@ -115,9 +115,10 @@ import { CertifySection, CurrentDirectors, DocumentsDelivery, StaffPayment, Tran import { AuthServices, LegalServices } from '@/services/' import { CommonMixin, FeeMixin, FilingTemplateMixin } from '@/mixins/' import { ActionBindingIF, EntitySnapshotIF, FlagsReviewCertifyIF, ResourceIF } from '@/interfaces/' -import { CorpTypeCd, FilingCodes, FilingStatus } from '@/enums/' +import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' +import { FilingCodes, FilingStatus } from '@/enums/' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' -import { CooperativeResource } from '@/resources/SpecialResolution/' +import { CpSpecialResolutionResource } from '@/resources/SpecialResolution/' @Component({ components: { @@ -176,7 +177,7 @@ export default class SpecialResolution extends Mixins( /** The resource file for an SpecialResolution filing. */ get specialResolutionResource (): ResourceIF { - if (this.isEntityTypeCP) return CooperativeResource + if (this.isEntityTypeCP) return CpSpecialResolutionResource return null } @@ -234,27 +235,26 @@ export default class SpecialResolution extends Mixins( this.parseEntitySnapshot(entitySnapshot) } - if (this.specialResolutionResource) { - // set the specific resource - this.setResource(this.specialResolutionResource) - - // initialize Fee Summary data - const filingData = [this.specialResolutionResource.filingData] - if (this.hasBusinessNameChanged) { - filingData.push({ - filingTypeCode: FilingCodes.SPECIAL_RESOLUTION_NAME_CHANGE, - entityType: CorpTypeCd.COOP, - priority: false - }) - } - filingData.forEach(fd => { - fd.futureEffective = this.getEffectiveDateTime.isFutureEffective + if (!this.specialResolutionResource) { + throw new Error(`Invalid special resolution resource entity type = ${this.getEntityType}`) + } + + // set the specific resource + this.setResource(this.specialResolutionResource) + + // initialize Fee Summary data + const filingData = [this.specialResolutionResource.filingData] + if (this.hasBusinessNameChanged) { + filingData.push({ + filingTypeCode: FilingCodes.SPECIAL_RESOLUTION_NAME_CHANGE, + entityType: CorpTypeCd.COOP, + priority: false }) - this.setFilingData(filingData) - } else { - // go to catch() - throw new Error(`Invalid Special Resolution resources entity type = ${this.getEntityType}`) } + filingData.forEach(fd => { + fd.futureEffective = this.getEffectiveDateTime.isFutureEffective + }) + this.setFilingData(filingData) // update the current fees for the Filing await this.setCurrentFeesFromFilingData(this.getEffectiveDateTime.isFutureEffective) diff --git a/tests/unit/ChangeSummary.spec.ts b/tests/unit/ChangeSummary.spec.ts index fe5970cb2..a767216fd 100644 --- a/tests/unit/ChangeSummary.spec.ts +++ b/tests/unit/ChangeSummary.spec.ts @@ -6,7 +6,7 @@ import { createLocalVue, mount } from '@vue/test-utils' import ChangeSummary from '@/components/Change/ChangeSummary.vue' import NatureOfBusiness from '@/components/common/YourCompany/NatureOfBusiness.vue' import OfficeAddresses from '@/components/common/YourCompany/OfficeAddresses.vue' -import { GeneralPartnershipResource } from '@/resources/Change/GeneralPartnershipResource' +import { GpChangeResource } from '@/resources/Change/GP' Vue.use(Vuetify) @@ -53,7 +53,7 @@ describe('Change Summary component', () => { store.state.stateModel.entitySnapshot = entitySnapshot store.state.stateModel.tombstone.filingType = 'changeOfRegistration' store.state.stateModel.businessInformation = { ...entitySnapshot.businessInfo } - store.state.resourceModel = GeneralPartnershipResource + store.state.resourceModel = GpChangeResource }) beforeEach(() => { diff --git a/tests/unit/ConversionSummary.spec.ts b/tests/unit/ConversionSummary.spec.ts index 186254913..64c55806a 100644 --- a/tests/unit/ConversionSummary.spec.ts +++ b/tests/unit/ConversionSummary.spec.ts @@ -6,7 +6,7 @@ import { createLocalVue, mount } from '@vue/test-utils' import ConversionSummary from '@/components/Conversion/ConversionSummary.vue' import NatureOfBusiness from '@/components/common/YourCompany/NatureOfBusiness.vue' import OfficeAddresses from '@/components/common/YourCompany/OfficeAddresses.vue' -import { GeneralPartnershipResource } from '@/resources/Change/GeneralPartnershipResource' +import { GpChangeResource } from '@/resources/Change/GP' Vue.use(Vuetify) @@ -53,7 +53,7 @@ describe('Conversion Summary component', () => { store.state.stateModel.entitySnapshot = entitySnapshot store.state.stateModel.tombstone.filingType = 'changeOfRegistration' store.state.stateModel.businessInformation = { ...entitySnapshot.businessInfo } - store.state.resourceModel = GeneralPartnershipResource + store.state.resourceModel = GpChangeResource }) beforeEach(() => { diff --git a/tests/unit/CreateSpecialResolution.spec.ts b/tests/unit/CreateSpecialResolution.spec.ts index 463966d2b..55f104a17 100644 --- a/tests/unit/CreateSpecialResolution.spec.ts +++ b/tests/unit/CreateSpecialResolution.spec.ts @@ -5,7 +5,7 @@ import { createLocalVue, mount } from '@vue/test-utils' import CreateSpecialResolution from '@/components/SpecialResolution/CreateSpecialResolution.vue' import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-picker/' import { HelpSection } from '@/components/common/' -import { CooperativeResource } from '@/resources/SpecialResolution/Cooperative' +import { CpSpecialResolutionResource } from '@/resources/SpecialResolution/CP' Vue.use(Vuetify) @@ -45,7 +45,7 @@ describe('Special Resolution Form component', () => { beforeEach(() => { // Set Original business Data - store.state.resourceModel = CooperativeResource + store.state.resourceModel = CpSpecialResolutionResource store.state.stateModel.nameRequest.legalName = entitySnapshot.businessInfo.legalName store.state.stateModel.tombstone.entityType = entitySnapshot.businessInfo.legalType store.state.stateModel.summaryMode = false @@ -86,7 +86,7 @@ describe('Special Resolution Form component', () => { const descText = wrapper.find('#sample-resolution-section .section-description') expect(descText.exists()).toBe(true) - expect(descText.text()).toContain(CooperativeResource.changeData.specialResolution.sampleFormSection.text) + expect(descText.text()).toContain(CpSpecialResolutionResource.changeData.specialResolution.sampleFormSection.text) }) it('renders the form input', async () => { diff --git a/tests/unit/FilingTypeToName.spec.ts b/tests/unit/FilingTypeToName.spec.ts index 73091fc17..ab58e3bdd 100644 --- a/tests/unit/FilingTypeToName.spec.ts +++ b/tests/unit/FilingTypeToName.spec.ts @@ -9,6 +9,7 @@ describe('Enum Mixin', () => { expect(FilingTypeToName('correction' as any)).toBe('Correction') expect(FilingTypeToName('incorporationApplication' as any)).toBe('Incorporation Application') expect(FilingTypeToName('registration' as any)).toBe('Registration') + expect(FilingTypeToName('specialResolution' as any)).toBe('Special Resolution') expect(FilingTypeToName('other type' as any)).toBe('Other type') }) }) diff --git a/tests/unit/ListPeopleAndRoles.spec.ts b/tests/unit/ListPeopleAndRoles.spec.ts index dfb693528..7aea69f7a 100644 --- a/tests/unit/ListPeopleAndRoles.spec.ts +++ b/tests/unit/ListPeopleAndRoles.spec.ts @@ -4,8 +4,8 @@ import Vuetify from 'vuetify' import { mount } from '@vue/test-utils' import ListPeopleAndRoles from '@/components/common/PeopleAndRoles/ListPeopleAndRoles.vue' import { getVuexStore } from '@/store/' -import { GeneralPartnershipResource as GpChangeResource } from '@/resources/Change/GeneralPartnershipResource' -import { BenCorrectionResource } from '@/resources/Correction/BenefitCompany' +import { GpChangeResource } from '@/resources/Change/GP' +import { BenCorrectionResource } from '@/resources/Correction/BEN' Vue.use(Vuetify) Vue.use(Vuelidate) diff --git a/tests/unit/NameChangeOptions.spec.ts b/tests/unit/NameChangeOptions.spec.ts new file mode 100644 index 000000000..8efb29858 --- /dev/null +++ b/tests/unit/NameChangeOptions.spec.ts @@ -0,0 +1,244 @@ +import Vue from 'vue' +import Vuetify from 'vuetify' +import { getVuexStore } from '@/store/' +import { mount } from '@vue/test-utils' +import YourCompany from '@/components/common/YourCompany/YourCompany.vue' + +import { BcAlterationResource } from '@/resources/Alteration/BC' +import { BenAlterationResource } from '@/resources/Alteration/BEN' +import { CccAlterationResource } from '@/resources/Alteration/CCC' +import { UlcAlterationResource } from '@/resources/Alteration/ULC' + +import { GpChangeResource } from '@/resources/Change/GP' +import { SpChangeResource } from '@/resources/Change/SP' + +import { GpConversionResource } from '@/resources/Conversion/GP' +import { SpConversionResource } from '@/resources/Conversion/SP' + +import { BcCorrectionResource } from '@/resources/Correction/BC' +import { BenCorrectionResource } from '@/resources/Correction/BEN' +import { CccCorrectionResource } from '@/resources/Correction/CCC' +import { GpCorrectionResource } from '@/resources/Correction/GP' +import { SpCorrectionResource } from '@/resources/Correction/SP' +import { UlcCorrectionResource } from '@/resources/Correction/ULC' + +import { CpSpecialResolutionResource } from '@/resources/SpecialResolution/CP' + +Vue.use(Vuetify) +const vuetify = new Vuetify({}) + +const alterationTests = [ + { + filingType: 'alteration', + entityType: 'BC', + resourceModel: BcAlterationResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'alteration', + entityType: 'BC', + resourceModel: BcAlterationResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number'] + }, + { + filingType: 'alteration', + entityType: 'BEN', + resourceModel: BenAlterationResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'alteration', + entityType: 'BEN', + resourceModel: BenAlterationResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number'] + }, + { + filingType: 'alteration', + entityType: 'CC', + resourceModel: CccAlterationResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'alteration', + entityType: 'CC', + resourceModel: CccAlterationResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number'] + }, + { + filingType: 'alteration', + entityType: 'ULC', + resourceModel: UlcAlterationResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'alteration', + entityType: 'ULC', + resourceModel: UlcAlterationResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number'] + } +] + +const changeTests = [ + { + filingType: 'changeOfRegistration', + entityType: 'GP', + resourceModel: GpChangeResource, + isNumberedCompany: null, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'changeOfRegistration', + entityType: 'SP', + resourceModel: SpChangeResource, + isNumberedCompany: null, + expectedOptions: ['correct-new-nr'] + } +] + +const conversionTests = [ + { + filingType: 'conversion', + entityType: 'GP', + resourceModel: GpConversionResource, + isNumberedCompany: null, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'conversion', + entityType: 'SP', + resourceModel: SpConversionResource, + isNumberedCompany: null, + expectedOptions: ['correct-new-nr'] + } +] + +const correctionTests = [ + { + filingType: 'correction', + entityType: 'BEN', + resourceModel: BenCorrectionResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'BEN', + resourceModel: BenCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number', 'correct-name'] + }, + { + filingType: 'correction', + entityType: 'CC', + resourceModel: CccCorrectionResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'CC', + resourceModel: CccCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number', 'correct-name'] + }, + { + filingType: 'correction', + entityType: 'GP', + resourceModel: GpCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'BC', + resourceModel: BcCorrectionResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'BC', + resourceModel: BcCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number', 'correct-name'] + }, + { + filingType: 'correction', + entityType: 'SP', + resourceModel: SpCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'ULC', + resourceModel: UlcCorrectionResource, + isNumberedCompany: true, + expectedOptions: ['correct-new-nr'] + }, + { + filingType: 'correction', + entityType: 'ULC', + resourceModel: UlcCorrectionResource, + isNumberedCompany: false, + expectedOptions: ['correct-new-nr', 'correct-name-to-number', 'correct-name'] + } +] + +const specialResolutionTests = [ + { + filingType: 'specialResolution', + entityType: 'CP', + resourceModel: CpSpecialResolutionResource, + isNumberedCompany: null, + expectedOptions: ['correct-new-nr'] + } +] + +/** A function that runs the specified test. */ +function runTest (test) { + const label = (test.isNumberedCompany === true) + ? `numbered ${test.entityType}` + : (test.isNumberedCompany === false) + ? `named ${test.entityType}` + : test.entityType + const store = getVuexStore() + + describe(`Name Change Options for filing type "${test.filingType}"`, () => { + it(`sets the correct options for a ${label}`, async () => { + // init + store.state.stateModel.tombstone.filingType = test.filingType + store.state.stateModel.tombstone.entityType = test.entityType + store.state.resourceModel = test.resourceModel + + // mount + const wrapper = mount(YourCompany, { + vuetify, + store, + computed: { isNumberedCompany: () => test.isNumberedCompany } + }) + await Vue.nextTick() + const vm = wrapper.vm as any + + // verify + expect(vm.nameChangeOptions).toEqual(test.expectedOptions) + + // cleanup + wrapper.destroy() + }) + }) +} + +for (const test of alterationTests) runTest(test) +for (const test of changeTests) runTest(test) +for (const test of conversionTests) runTest(test) +for (const test of correctionTests) runTest(test) +for (const test of specialResolutionTests) runTest(test) diff --git a/tests/unit/OfficeAddresses.spec.ts b/tests/unit/OfficeAddresses.spec.ts index 75d404e56..c82a9f3ff 100644 --- a/tests/unit/OfficeAddresses.spec.ts +++ b/tests/unit/OfficeAddresses.spec.ts @@ -5,7 +5,7 @@ import { getVuexStore } from '@/store/' import { mount } from '@vue/test-utils' import OfficeAddresses from '@/components/common/YourCompany/OfficeAddresses.vue' import { AddressIF, AddressesIF } from '@/interfaces/stepper-interfaces/YourCompany/address-interfaces' -import { BenefitCompanyResource } from '@/resources/Alteration/BenefitCompanyResource' +import { BenAlterationResource } from '@/resources/Alteration/BEN' // mock the console.warn function to hide "[Vuetify] Unable to locate target XXX" console.warn = jest.fn() @@ -58,7 +58,7 @@ describe('summary mode', () => { beforeAll(() => { // init entity type store.state.stateModel.tombstone.entityType = 'BEN' - store.state.resourceModel = BenefitCompanyResource + store.state.resourceModel = BenAlterationResource }) it('displays the correct sections', () => { diff --git a/tests/unit/OrgPerson.spec.ts b/tests/unit/OrgPerson.spec.ts index 7107056fa..628cfa518 100644 --- a/tests/unit/OrgPerson.spec.ts +++ b/tests/unit/OrgPerson.spec.ts @@ -4,10 +4,9 @@ import Vuelidate from 'vuelidate' import { mount, Wrapper, createLocalVue } from '@vue/test-utils' import OrgPerson from '@/components/common/PeopleAndRoles/OrgPerson.vue' import { getVuexStore } from '@/store/' -import { BenCorrectionResource as CorrectionBenefitCompanyResource } - from '@/resources/Correction/BenefitCompany' -import { SoleProprietorshipResource } from '@/resources/Change/SoleProprietorshipResource' -import { GeneralPartnershipResource } from '@/resources/Change/GeneralPartnershipResource' +import { BenCorrectionResource } from '@/resources/Correction/BEN' +import { SpChangeResource } from '@/resources/Change/SP' +import { GpChangeResource } from '@/resources/Change/GP' // mock the console.warn function to hide "[Vuetify] Unable to locate target XXX" console.warn = jest.fn() @@ -207,7 +206,7 @@ describe('Org/Person component for a BEN Correction filing', () => { store.state.stateModel.tombstone.filingType = 'correction' store.state.stateModel.tombstone.entityType = 'BEN' store.state.stateModel.tombstone.currentDate = '2020-03-30' - store.state.resourceModel = CorrectionBenefitCompanyResource + store.state.resourceModel = BenCorrectionResource }) it('Loads the component and sets data for person', async () => { @@ -577,7 +576,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'adds new GP partner-person', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: NewPersonPartner, activeIndex: NaN, addPersonHeader: 'Add Person', @@ -599,7 +598,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'adds new GP partner-organization', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: NewOrgPartner, activeIndex: NaN, addPersonHeader: false, @@ -621,7 +620,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'changes existing SP proprietor-person', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: ExistingProprietorPersonData, activeIndex: 0, addPersonHeader: 'Edit Person', @@ -643,7 +642,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'changes existing SP proprietor-organization', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: ExistingProprietorOrgData, activeIndex: 0, addPersonHeader: false, @@ -665,7 +664,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'changes existing GP partner-person', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: ExistingPartnerPersonData, activeIndex: 0, addPersonHeader: 'Edit Person', @@ -687,7 +686,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'changeOfRegistration', name: 'changes existing GP partner - organization', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: ExistingPartnerOrgData, activeIndex: 0, addPersonHeader: false, @@ -709,7 +708,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'adds new SP proprietor-person', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: NewPersonProprietor, activeIndex: NaN, addPersonHeader: 'Add Person', @@ -731,7 +730,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'adds new SP proprietor-organization', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: NewOrgProprietor, activeIndex: NaN, addPersonHeader: false, @@ -753,7 +752,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'adds new GP partner-person', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: NewPersonProprietor, activeIndex: NaN, addPersonHeader: 'Add Person', @@ -775,7 +774,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'adds new GP partner-organization', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: NewOrgProprietor, activeIndex: NaN, addPersonHeader: false, @@ -797,7 +796,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'changes existing SP proprietor - person', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: ExistingProprietorPersonData, activeIndex: 0, addPersonHeader: 'Edit Person', @@ -819,7 +818,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'changes existing SP proprietor-organization', entityType: 'SP', - resourceModel: SoleProprietorshipResource, + resourceModel: SpChangeResource, currentOrgPerson: ExistingProprietorOrgData, activeIndex: 0, addPersonHeader: false, @@ -841,7 +840,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'changes existing GP partner-person', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: ExistingPartnerPersonData, activeIndex: 0, addPersonHeader: 'Edit Person', @@ -863,7 +862,7 @@ describe('Org/Person component for SP/GP filings', () => { filingType: 'conversion', name: 'changes existing GP partner-organization', entityType: 'GP', - resourceModel: GeneralPartnershipResource, + resourceModel: GpChangeResource, currentOrgPerson: ExistingPartnerOrgData, activeIndex: 0, addPersonHeader: false, @@ -971,13 +970,13 @@ describe('Org/Person component for SP change of registration filing', () => { store.state.stateModel.tombstone.currentDate = '2020-03-30' store.state.stateModel.tombstone.filingType = 'changeOfRegistration' store.state.stateModel.tombstone.entityType = 'SP' - store.state.resourceModel = SoleProprietorshipResource + store.state.resourceModel = SpChangeResource }) it('displays Confirm Documents checkbox for a replaced-added org-person', () => { store.state.stateModel.tombstone.filingType = 'changeOfRegistration' store.state.stateModel.tombstone.entityType = 'SP' - store.state.resourceModel = SoleProprietorshipResource + store.state.resourceModel = SpChangeResource const currentOrgPerson = { ...NewOrgProprietor, diff --git a/tests/unit/PeopleAndRoles.spec.ts b/tests/unit/PeopleAndRoles.spec.ts index c960e5f51..92f189917 100644 --- a/tests/unit/PeopleAndRoles.spec.ts +++ b/tests/unit/PeopleAndRoles.spec.ts @@ -1,8 +1,8 @@ import Vue from 'vue' import Vuelidate from 'vuelidate' import Vuetify from 'vuetify' -import { GeneralPartnershipResource } from '@/resources/Change/GeneralPartnershipResource' -import { BenCorrectionResource } from '@/resources/Correction/BenefitCompany' +import { GpChangeResource } from '@/resources/Change/GP' +import { BenCorrectionResource } from '@/resources/Correction/BEN' import { getVuexStore } from '@/store/' import { mount, shallowMount } from '@vue/test-utils' import PeopleAndRoles from '@/components/common/PeopleAndRoles/PeopleAndRoles.vue' @@ -203,7 +203,7 @@ describe('People And Roles component for Change of Registration', () => { beforeAll(() => { store.state.stateModel.tombstone.entityType = 'GP' store.state.stateModel.tombstone.filingType = 'changeOfRegistration' - store.state.resourceModel = GeneralPartnershipResource + store.state.resourceModel = GpChangeResource wrapperFactory = () => { return mount(PeopleAndRoles, { diff --git a/tests/unit/YourCompany.spec.ts b/tests/unit/YourCompany.spec.ts index d7ca461ce..dca7114cc 100644 --- a/tests/unit/YourCompany.spec.ts +++ b/tests/unit/YourCompany.spec.ts @@ -1,9 +1,10 @@ import Vue from 'vue' import Vuetify from 'vuetify' import { getVuexStore } from '@/store/' -import { createLocalVue, mount } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import BusinessContactInfo from '@/components/common/YourCompany/BusinessContactInfo.vue' import ConversionNOB from '@/components/Conversion/ConversionNOB.vue' + // for some reason, ChangeBusinessType cannot be imported by its filename // also, it needs to precede the other imports // (otherwise a bunch of tests in this file fail) @@ -13,14 +14,12 @@ import CorrectNameOptions from '@/components/common/YourCompany/CompanyName/Corr import FolioInformation from '@/components/common/YourCompany/FolioInformation.vue' import OfficeAddresses from '@/components/common/YourCompany/OfficeAddresses.vue' import YourCompany from '@/components/common/YourCompany/YourCompany.vue' -import { BenefitCompanyResource as BenAlterationResource } from '@/resources/Alteration/BenefitCompanyResource' -import { SoleProprietorshipResource as SpConversionResource } from '@/resources/Conversion/SoleProprietorshipResource' -import { BenCorrectionResource } from '@/resources/Correction/BenefitCompany' -import { SpCorrectionResource } from '@/resources/Correction/SoleProprietorship' +import { BenAlterationResource } from '@/resources/Alteration/BEN' +import { SpConversionResource } from '@/resources/Conversion/SP' +import { BenCorrectionResource } from '@/resources/Correction/BEN' +import { SpCorrectionResource } from '@/resources/Correction/SP' Vue.use(Vuetify) - -const localVue = createLocalVue() const vuetify = new Vuetify({}) const flagsCompanyInfo = { @@ -36,14 +35,14 @@ const flagsCompanyInfo = { } describe('YourCompany in a BEN correction', () => { + const store = getVuexStore() let wrapper: any - let store: any = getVuexStore() beforeEach(() => { store.state.stateModel.tombstone.filingType = 'correction' store.state.stateModel.tombstone.entityType = 'BEN' store.state.resourceModel = BenCorrectionResource - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) }) afterEach(() => { @@ -87,8 +86,8 @@ describe('YourCompany in a BEN correction', () => { }) describe('YourCompany in a SP alteration', () => { + const store = getVuexStore() let wrapper: any - let store: any = getVuexStore() const entitySnapshot = { businessInfo: { @@ -107,7 +106,7 @@ describe('YourCompany in a SP alteration', () => { store.state.stateModel.tombstone.entityType = 'BEN' store.state.resourceModel = BenAlterationResource - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) }) afterEach(() => { @@ -190,8 +189,9 @@ describe('YourCompany in a SP alteration: formats multiple phone numbers correct const outPuts = ['(123) 456-7890', '(098) 765-4321', '(123) 456-7890', '(123) 456-7890', 'N/A', 'N/A'] phoneNumbers.forEach((phoneNumber, index) => { + const store = getVuexStore() let wrapper: any - let store: any = getVuexStore() + beforeEach(() => { store.state.stateModel.nameRequest.applicant = { fullName: 'Mock Full Name', @@ -200,7 +200,7 @@ describe('YourCompany in a SP alteration: formats multiple phone numbers correct } store.state.stateModel.nameRequest.nrNumber = 'NR1234567' store.state.stateModel.tombstone.filingType = 'alteration' - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) }) afterEach(() => { @@ -217,8 +217,8 @@ describe('YourCompany in a SP alteration: formats multiple phone numbers correct }) describe('YourCompany in a SP conversion', () => { + const store = getVuexStore() let wrapper: any - let store: any = getVuexStore() beforeEach(() => { // Set Original business Data @@ -228,7 +228,7 @@ describe('YourCompany in a SP conversion', () => { store.state.resourceModel = SpConversionResource store.state.stateModel.validationFlags.componentValidate = true store.state.stateModel.validationFlags.flagsCompanyInfo = flagsCompanyInfo - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) }) afterEach(() => { @@ -247,14 +247,14 @@ describe('YourCompany in a SP conversion', () => { it('renders the NatureOfBusiness component with invalid styling', async () => { store.state.stateModel.validationFlags.flagsCompanyInfo.isValidNatureOfBusiness = false - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) expect(wrapper.find('#nature-of-business.invalid-section').exists()).toBeTruthy() }) }) describe('YourCompany in a SP correction', () => { + const store = getVuexStore() let wrapper: any - let store: any = getVuexStore() beforeEach(() => { // Set Original business Data @@ -266,7 +266,7 @@ describe('YourCompany in a SP correction', () => { store.state.stateModel.validationFlags.flagsCompanyInfo = flagsCompanyInfo store.state.stateModel.businessInformation.foundingDate = '2021-04-13T00:00:00+00:00' store.state.stateModel.businessInformation.startDate = '2021-04-13' - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) }) afterEach(() => { @@ -337,7 +337,7 @@ describe('YourCompany in a SP correction', () => { it('renders association type for CP', async () => { store.state.stateModel.tombstone.entityType = 'CP' - wrapper = mount(YourCompany, { vuetify, store, localVue }) + wrapper = mount(YourCompany, { vuetify, store }) expect(wrapper.findComponent(YourCompany).exists()).toBeTruthy() expect(wrapper.findComponent(AssociationType).exists()).toBeTruthy() })