diff --git a/package-lock.json b/package-lock.json index d354223d..b95e6d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,7 +68,7 @@ "@typescript-eslint/eslint-plugin": "^5.59.2", "@typescript-eslint/parser": "^5.59.2", "@vitejs/plugin-vue2": "^2.2.0", - "@volar-plugins/vetur": "*", + "@volar-plugins/vetur": "latest", "@vue/eslint-config-standard": "^4.0.0", "@vue/eslint-config-typescript": "^9.1.0", "@vue/test-utils": "^1.3.5", diff --git a/src/services/legal-services.ts b/src/services/legal-services.ts index b7d01128..7ba2b798 100644 --- a/src/services/legal-services.ts +++ b/src/services/legal-services.ts @@ -202,6 +202,14 @@ export default class LegalServices { if (directors) { // convert director list to org-person list return directors.map(director => { + // WORK-AROUND WARNING !!! + // convert directors from "middleInitial" to "middleName" + const middleInitial = director.officer['middleInitial'] + if (middleInitial !== undefined) { + director.officer.middleName = middleInitial + delete director.officer['middleInitial'] + } + const orgPerson: OrgPersonIF = { deliveryAddress: director.deliveryAddress, mailingAddress: director.mailingAddress, @@ -236,7 +244,16 @@ export default class LegalServices { .then(response => { const parties = response?.data?.parties if (parties) { - return parties + // WORK-AROUND WARNING !!! + // convert parties from "middleInitial" to "middleName" + return parties.map(party => { + const middleInitial = party.officer['middleInitial'] + if (middleInitial !== undefined) { + party.officer.middleName = middleInitial + delete party.officer['middleInitial'] + } + return party + }) } // eslint-disable-next-line no-console console.log('fetchParties() error - invalid response =', response) diff --git a/src/views/Change.vue b/src/views/Change.vue index 1e150d6e..e94bdbcf 100644 --- a/src/views/Change.vue +++ b/src/views/Change.vue @@ -285,22 +285,11 @@ export default class Change extends Mixins(CommonMixin, FeeMixin, FilingTemplate if (items.length !== 4) throw new Error('Failed to fetch entity snapshot') - // WORK-AROUND WARNING !!! - // convert orgPersons from "middleInitial" to "middleName" - const orgPersons = items[3].map(orgPerson => { - const middleInitial = orgPerson.officer['middleInitial'] - if (middleInitial !== undefined) { - orgPerson.officer.middleName = middleInitial - delete orgPerson.officer['middleInitial'] - } - return orgPerson - }) - return { businessInfo: items[0], authInfo: items[1], addresses: items[2], - orgPersons + orgPersons: items[3] } as EntitySnapshotIF } diff --git a/src/views/Conversion.vue b/src/views/Conversion.vue index 3a2666d2..a30c3a9a 100644 --- a/src/views/Conversion.vue +++ b/src/views/Conversion.vue @@ -240,22 +240,11 @@ export default class Conversion extends Mixins(CommonMixin, FeeMixin, FilingTemp throw new Error('Failed to fetch entity addresses') }) - // WORK-AROUND WARNING !!! - // convert orgPersons from "middleInitial" to "middleName" - const orgPersons = items[2].map(orgPerson => { - const middleInitial = orgPerson.officer['middleInitial'] - if (middleInitial !== undefined) { - orgPerson.officer.middleName = middleInitial - delete orgPerson.officer['middleInitial'] - } - return orgPerson - }) - return { businessInfo: items[0], authInfo: items[1], addresses, - orgPersons + orgPersons: items[2] } as EntitySnapshotIF } /** Emits Fetch Error event. */ diff --git a/tests/unit/legal-services.spec.ts b/tests/unit/legal-services.spec.ts index 7f3b7238..ae4851b0 100644 --- a/tests/unit/legal-services.spec.ts +++ b/tests/unit/legal-services.spec.ts @@ -138,8 +138,8 @@ describe('Legal Services', () => { it('fetches directors correctly', async () => { const DIRECTORS = [ - { appointmentDate: '2022-04-01' }, - { appointmentDate: '2022-05-01' } + { appointmentDate: '2022-04-01', officer: {} }, + { appointmentDate: '2022-05-01', officer: {} } ] const ORGPERSONS = [ { roles: [{ appointmentDate: '2022-04-01', roleType: 'Director' }] }, @@ -160,9 +160,9 @@ describe('Legal Services', () => { it('fetches parties correctly', async () => { const PARTIES = [ - { roles: [{ appointmentDate: '2022-04-01', roleType: 'Completing Party' }] }, - { roles: [{ appointmentDate: '2022-04-01', roleType: 'Incorporator' }] }, - { roles: [{ appointmentDate: '2022-05-01', roleType: 'Director' }] } + { officer: {}, roles: [{ appointmentDate: '2022-04-01', roleType: 'Completing Party' }] }, + { officer: {}, roles: [{ appointmentDate: '2022-04-01', roleType: 'Incorporator' }] }, + { officer: {}, roles: [{ appointmentDate: '2022-05-01', roleType: 'Director' }] } ] // mock endpoint