From 6dd8928a8f8a7bacd066a3da07c329ba6c72a536 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Tue, 13 Feb 2024 11:35:32 -0800 Subject: [PATCH 1/6] 19044 - unit tests for Short amalgmation resources --- tests/unit/AmalgamationInformation.spec.ts | 97 +++++++++++++++++- tests/unit/AmalgamationPeopleRoles.spec.ts | 15 ++- tests/unit/AmalgamationReviewConfirm.spec.ts | 100 ++++++++++++++++++- tests/unit/PeopleAndRoles.spec.ts | 55 ++++++++++ 4 files changed, 253 insertions(+), 14 deletions(-) diff --git a/tests/unit/AmalgamationInformation.spec.ts b/tests/unit/AmalgamationInformation.spec.ts index eecde456b..66c52597b 100644 --- a/tests/unit/AmalgamationInformation.spec.ts +++ b/tests/unit/AmalgamationInformation.spec.ts @@ -1,7 +1,7 @@ import { shallowWrapperFactory } from '../vitest-wrapper-factory' import { AmalgamationInformation } from '@/views' // *** FUTURE: add tests for AmalgamationShortResources -import { AmalgamationRegResources } from '@/resources/' +import { AmalgamationRegResources, AmalgamationShortResources } from '@/resources/' import AmalgamatingBusinesses from '@/components/Amalgamation/AmalgamatingBusinesses.vue' import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' import ResultingBusinessName from '@/components/Amalgamation/ResultingBusinessName.vue' @@ -9,7 +9,7 @@ import BusinessTypeHelp from '@/components/Amalgamation/BusinessTypeHelp.vue' import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums' // Test Case Data -const amalgamationRegularBusinessInfo = [ +const amalgamationBusinessInfo = [ { entityType: 'BEN' }, @@ -24,7 +24,7 @@ const amalgamationRegularBusinessInfo = [ } ] -for (const test of amalgamationRegularBusinessInfo) { +for (const test of amalgamationBusinessInfo) { describe(`Amalgamation-Regular Information for a ${test.entityType}`, () => { let wrapper: any @@ -33,7 +33,7 @@ for (const test of amalgamationRegularBusinessInfo) { AmalgamationInformation, null, { - amalgamation: { type: AmalgamationTypes.REGULAR }, // *** FUTURE: add tests for short-form amalgamations + amalgamation: { type: AmalgamationTypes.REGULAR }, entityType: test.entityType, tombstone: { filingType: FilingTypes.AMALGAMATION_APPLICATION, @@ -69,3 +69,92 @@ for (const test of amalgamationRegularBusinessInfo) { }) }) } + +for (const test of amalgamationBusinessInfo) { + describe(`Amalgamation- Short Horizontal Information for a ${test.entityType}`, () => { + let wrapper: any + + beforeAll(() => { + wrapper = shallowWrapperFactory( + AmalgamationInformation, + null, + { + amalgamation: { type: AmalgamationTypes.HORIZONTAL }, + entityType: test.entityType, + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: ['staff'] + } + }, + null, + AmalgamationShortResources + ) + }) + + afterAll(() => { + wrapper.destroy() + }) + + it('renders the page', () => { + expect(wrapper.find('#amalgamation-information').exists()).toBe(true) + }) + + it('displays the Amalgamation Businesses section', () => { + console.log(wrapper.html()) + const section = wrapper.findAll('section').at(0) + expect(section.find('header h2').text()).toBe('Amalgamating Businesses') + expect(section.find('p').text()).toContain('Add the primary business and the amalgamating businesses below.') + expect(section.findComponent(AmalgamatingBusinesses).exists()).toBe(true) + }) + + it('displays the Resulting Business Name and Type section', () => { + const section = wrapper.findAll('section').at(1) + expect(section.find('header h2').text()).toBe('Resulting Business Name and Type') + expect(section.findComponent(ResultingBusinessName).exists()).toBe(true) + }) + }) +} + +for (const test of amalgamationBusinessInfo) { + describe(`Amalgamation- Short Vertical Information for a ${test.entityType}`, () => { + let wrapper: any + + beforeAll(() => { + wrapper = shallowWrapperFactory( + AmalgamationInformation, + null, + { + amalgamation: { type: AmalgamationTypes.VERTICAL }, + entityType: test.entityType, + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: ['staff'] + } + }, + null, + AmalgamationShortResources + ) + }) + + afterAll(() => { + wrapper.destroy() + }) + + it('renders the page', () => { + expect(wrapper.find('#amalgamation-information').exists()).toBe(true) + }) + + it('displays the Amalgamation Businesses section', () => { + const section = wrapper.findAll('section').at(0) + expect(section.find('header h2').text()).toBe('Amalgamating Businesses') + expect(section.find('p').text()).toContain('Add the holding business and the amalgamating businesses below.') + expect(section.findComponent(AmalgamatingBusinesses).exists()).toBe(true) + }) + + it('displays the Resulting Business Name and Type section', () => { + const section = wrapper.findAll('section').at(1) + expect(section.find('header h2').text()).toBe('Resulting Business Name and Type') + expect(section.findComponent(ResultingBusinessName).exists()).toBe(true) + }) + }) +} diff --git a/tests/unit/AmalgamationPeopleRoles.spec.ts b/tests/unit/AmalgamationPeopleRoles.spec.ts index 033f7fce9..618d8467b 100644 --- a/tests/unit/AmalgamationPeopleRoles.spec.ts +++ b/tests/unit/AmalgamationPeopleRoles.spec.ts @@ -2,6 +2,7 @@ import { shallowWrapperFactory } from '../vitest-wrapper-factory' import { AmalgamationPeopleRoles } from '@/views' import { AmalgamationRegResources, AmalgamationShortResources } from '@/resources/' import PeopleAndRoles from '@/components/common/PeopleAndRoles.vue' +import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums' // Test Case Data const amalgamationRegularBusinessInfo = [ @@ -28,8 +29,11 @@ for (const test of amalgamationRegularBusinessInfo) { AmalgamationPeopleRoles, null, { + amalgamation: { type: AmalgamationTypes.REGULAR }, entityType: test.entityType, - tombstone: { keycloakRoles: ['staff'] } + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: ['staff'] } }, null, AmalgamationRegResources @@ -50,9 +54,7 @@ for (const test of amalgamationRegularBusinessInfo) { }) }) - // *** TODO: finish the tests for short-form amalgamations - // especially differences between regular and short-form - describe(`Amalgamation-Regular People and Roles for a ${test.entityType}`, () => { + describe(`Amalgamation-Short People and Roles for a ${test.entityType}`, () => { let wrapper: any beforeAll(() => { @@ -60,8 +62,11 @@ for (const test of amalgamationRegularBusinessInfo) { AmalgamationPeopleRoles, null, { + amalgamation: { type: AmalgamationTypes.HORIZONTAL }, entityType: test.entityType, - tombstone: { keycloakRoles: ['staff'] } + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: ['staff'] } }, null, AmalgamationShortResources diff --git a/tests/unit/AmalgamationReviewConfirm.spec.ts b/tests/unit/AmalgamationReviewConfirm.spec.ts index 497e1f0b6..be52586f5 100644 --- a/tests/unit/AmalgamationReviewConfirm.spec.ts +++ b/tests/unit/AmalgamationReviewConfirm.spec.ts @@ -11,9 +11,10 @@ import SummaryDefineCompany from '@/components/common/SummaryDefineCompany.vue' import { DocumentDelivery } from '@bcrs-shared-components/document-delivery' import Certify from '@/components/common/Certify.vue' import StaffPayment from '@/components/common/StaffPayment.vue' +import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums' // Test Case Data -const amalgamationRegularBusinessInfo = [ +const amalgamationBusinessInfo = [ { entityType: 'BEN' }, @@ -28,8 +29,8 @@ const amalgamationRegularBusinessInfo = [ } ] -for (const test of amalgamationRegularBusinessInfo) { - describe(`Amalgamation-Regular Review Confirm for a ${test.entityType}`, () => { +for (const test of amalgamationBusinessInfo) { + describe(`Amalgamation-Regular Review Confirm for a ${test.entityType} as Staff`, () => { let wrapper: any beforeAll(() => { @@ -37,9 +38,12 @@ for (const test of amalgamationRegularBusinessInfo) { AmalgamationReviewConfirm, null, { - // *** FUTURE: add tests for regular vs short-form amalgamations + amalgamation: { type: AmalgamationTypes.REGULAR }, entityType: test.entityType, - tombstone: { keycloakRoles: ['staff'] } + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: ['staff'] + } }, null, null @@ -125,4 +129,90 @@ for (const test of amalgamationRegularBusinessInfo) { expect(section.findComponent(StaffPayment).exists()).toBe(true) }) }) + + describe(`Amalgamation-Short Review Confirm for a ${test.entityType} as Regular user`, () => { + let wrapper: any + + beforeAll(() => { + wrapper = shallowWrapperFactory( + AmalgamationReviewConfirm, + null, + { + amalgamation: { type: AmalgamationTypes.HORIZONTAL }, + entityType: test.entityType, + tombstone: { + filingType: FilingTypes.AMALGAMATION_APPLICATION, + keycloakRoles: [] + } + }, + null, + null + ) + }) + + afterAll(() => { + wrapper.destroy() + }) + + it('renders the page', () => { + expect(wrapper.find('#amalgamation-review-confirm').exists()).toBe(true) + }) + + it('displays Review and Confirm section', async () => { + const section = wrapper.findAll('section').at(0) + expect(section.find('header h2').text()).toBe('Review and Confirm') + expect(section.find('p').text()).toContain('Review the information in your application.') + expect(section.find('p').text()).toContain('If you need to change or complete anything, return to the step') + + // verify amalgamation application vcard + let vcard = section.find('#company-summary-vcard') + expect(vcard.findComponent(CardHeader).attributes('label')).toBe('Amalgamation Information') + expect(vcard.findComponent(SummaryDefineCompany).exists()).toBe(true) + + // verify amalgamating businesses information vcard + vcard = section.find('#amalgamating-businesses-information-vcard') + expect(vcard.findComponent(CardHeader).attributes('label')).toBe('Amalgamating Businesses Information') + expect(vcard.findComponent(BusinessTableSummary).exists()).toBe(true) + + // verify people and roles vcard + vcard = section.find('#people-and-roles-vcard') + expect(vcard.findComponent(CardHeader).attributes('label')).toBe('People and Roles') + expect(vcard.findComponent(ListPeopleAndRoles).exists()).toBe(true) + + // verify share structure vcard + vcard = section.find('#share-structure-vcard') + expect(vcard.findComponent(CardHeader).attributes('label')).toBe('Share Structure') + expect(vcard.findComponent(ListShareClass).exists()).toBe(true) + }) + + it('displays Amalgamation Date and Time section', () => { + const section = wrapper.findAll('section').at(1) + expect(section.find('header h2').text()).toBe('Amalgamation Date and Time') + expect(section.find('p').text()).toContain('Select the Date and Time of amalgamation for your business.') + expect(section.findComponent(EffectiveDateTime).exists()).toBe(true) + }) + + it('displays Document Delivery section', () => { + const section = wrapper.findAll('section').at(2) + expect(section.find('header h2').text()).toBe('Document Delivery') + expect(section.find('p').text()).toContain('Copies of the amalgamation documents will be sent') + expect(section.find('p').text()).toContain('to the email addresses listed below.') + expect(section.findComponent(DocumentDelivery).exists()).toBe(true) + }) + + it('displays Amalgamation Statement section', () => { + const section = wrapper.findAll('section').at(3) + expect(section.find('header h2').text()).toBe('Amalgamation Statement') + expect(section.find('p').text()).toContain('Please indicate the statement applicable to this amalgamation.') + expect(section.findComponent(AmalgamationStatement).exists()).toBe(true) + }) + + it('displays Certify section', () => { + const section = wrapper.findAll('section').at(4) + expect(section.find('header h2').text()).toBe('Certify') + expect(section.find('p').text()).toContain('Confirm the legal name of the person authorized') + expect(section.find('p').text()).toContain('to complete and submit this application.') + expect(section.findComponent(Certify).exists()).toBe(true) + }) + }) } diff --git a/tests/unit/PeopleAndRoles.spec.ts b/tests/unit/PeopleAndRoles.spec.ts index 4ea025de8..5db27c8bf 100644 --- a/tests/unit/PeopleAndRoles.spec.ts +++ b/tests/unit/PeopleAndRoles.spec.ts @@ -8,6 +8,7 @@ import { createLocalVue, mount } from '@vue/test-utils' import PeopleAndRoles from '@/components/common/PeopleAndRoles.vue' import { IncorporationResourceBen } from '@/resources/Incorporation/BEN' import { ResourceIF } from '@/interfaces' +import { AmalgamationShortResourceBc } from '@/resources/AmalgamationShort' const vuetify = new Vuetify({}) setActivePinia(createPinia()) @@ -167,3 +168,57 @@ describe('People And Roles component', () => { resetStore() }) }) + +describe('People And Roles component - Amalgamation Short form', () => { + let wrapperFactory: any + + beforeEach(() => { + const localVue = createLocalVue() + localVue.use(VueRouter) + const router = mockRouter.mock() + + store.resourceModel = AmalgamationShortResourceBc as ResourceIF + + wrapperFactory = () => { + return mount(PeopleAndRoles, { + localVue, + router, + vuetify + }) + } + }) + + it('shows correct blurb text', () => { + store.stateModel.addPeopleAndRoleStep.orgPeople = [] + const wrapper = wrapperFactory() + expect(wrapper.find('.blurb-para').text()).toContain('Add the Completing Party to this application') + expect(wrapper.find('.rule-item-txt').text()).toContain('The Completing Party') + }) + + it('shows Start by Adding Completing Party Button when people list is empty', () => { + store.stateModel.addPeopleAndRoleStep.orgPeople = [] + const wrapper = wrapperFactory() + expect(wrapper.find(btnStartAddCompletingParty).exists()).toBeTruthy() + expect(wrapper.find(btnStartAddCompletingParty).text()).toContain('Start by Adding the Completing Party') + wrapper.destroy() + }) + + it('does not show Add Completing Party Button when people list has Completing Party', () => { + store.stateModel.addPeopleAndRoleStep.orgPeople = getPersonList() + const wrapper = wrapperFactory() + expect(wrapper.find(btnAddCompletingParty).exists()).toBeFalsy() + wrapper.destroy() + resetStore() + }) + + it('Shows check mark next to roles added', () => { + store.stateModel.addPeopleAndRoleStep.orgPeople = getPersonList([ + { roleType: 'Completing Party', appointmentDate: '2020-03-30' } + ]) + const wrapper = wrapperFactory() + expect(wrapper.find(checkCompletingParty).exists()).toBeTruthy() + expect(wrapper.find(checkDirector).exists()).toBeFalsy() + wrapper.destroy() + resetStore() + }) +}) From fc38aace4caf7b0651b59184fb3e51a7710198c4 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Wed, 14 Feb 2024 10:08:20 -0800 Subject: [PATCH 2/6] 19044 - clean up --- tests/unit/AmalgamatingBusinesses.spec.ts | 4 ++-- tests/unit/AmalgamationInformation.spec.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/unit/AmalgamatingBusinesses.spec.ts b/tests/unit/AmalgamatingBusinesses.spec.ts index 76af923fc..27eb041fb 100644 --- a/tests/unit/AmalgamatingBusinesses.spec.ts +++ b/tests/unit/AmalgamatingBusinesses.spec.ts @@ -73,11 +73,11 @@ describe('Amalgamating Businesses - components and validity', () => { }) it('computes havePrimaryBusiness correctly', () => { - // verify with no holding businesses + // verify with no primary businesses store.stateModel.amalgamation.amalgamatingBusinesses = [] expect(wrapper.vm.havePrimaryBusiness).toBe(false) - // verify with a holding business + // verify with a primary business store.stateModel.amalgamation.amalgamatingBusinesses = [ { role: AmlRoles.PRIMARY } as AmalgamatingBusinessIF ] diff --git a/tests/unit/AmalgamationInformation.spec.ts b/tests/unit/AmalgamationInformation.spec.ts index 66c52597b..4313eab15 100644 --- a/tests/unit/AmalgamationInformation.spec.ts +++ b/tests/unit/AmalgamationInformation.spec.ts @@ -100,7 +100,6 @@ for (const test of amalgamationBusinessInfo) { }) it('displays the Amalgamation Businesses section', () => { - console.log(wrapper.html()) const section = wrapper.findAll('section').at(0) expect(section.find('header h2').text()).toBe('Amalgamating Businesses') expect(section.find('p').text()).toContain('Add the primary business and the amalgamating businesses below.') From b80507739a0ef9adfe164ca26ad9a724a9b2fd7d Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Wed, 14 Feb 2024 10:13:10 -0800 Subject: [PATCH 3/6] 19044 - add comment --- tests/unit/AmalgamationPeopleRoles.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/AmalgamationPeopleRoles.spec.ts b/tests/unit/AmalgamationPeopleRoles.spec.ts index 618d8467b..a16074353 100644 --- a/tests/unit/AmalgamationPeopleRoles.spec.ts +++ b/tests/unit/AmalgamationPeopleRoles.spec.ts @@ -5,7 +5,7 @@ import PeopleAndRoles from '@/components/common/PeopleAndRoles.vue' import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums' // Test Case Data -const amalgamationRegularBusinessInfo = [ +const amalgamationBusinessInfo = [ { entityType: 'BEN' }, @@ -20,7 +20,7 @@ const amalgamationRegularBusinessInfo = [ } ] -for (const test of amalgamationRegularBusinessInfo) { +for (const test of amalgamationBusinessInfo) { describe(`Amalgamation-Regular People and Roles for a ${test.entityType}`, () => { let wrapper: any @@ -54,6 +54,9 @@ for (const test of amalgamationRegularBusinessInfo) { }) }) + /** + * Unit tests for Vertical will be similar to the test below + */ describe(`Amalgamation-Short People and Roles for a ${test.entityType}`, () => { let wrapper: any From b3e757fb47b5a987bfb536c3843bc6391b22c5e8 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Wed, 14 Feb 2024 13:47:14 -0800 Subject: [PATCH 4/6] 19044 - remove comment --- tests/unit/AmalgamationInformation.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/AmalgamationInformation.spec.ts b/tests/unit/AmalgamationInformation.spec.ts index 4313eab15..350262d3b 100644 --- a/tests/unit/AmalgamationInformation.spec.ts +++ b/tests/unit/AmalgamationInformation.spec.ts @@ -1,6 +1,5 @@ import { shallowWrapperFactory } from '../vitest-wrapper-factory' import { AmalgamationInformation } from '@/views' -// *** FUTURE: add tests for AmalgamationShortResources import { AmalgamationRegResources, AmalgamationShortResources } from '@/resources/' import AmalgamatingBusinesses from '@/components/Amalgamation/AmalgamatingBusinesses.vue' import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' From b21cd283dc59ece51cbd83fc433a84bfc97409c5 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Wed, 14 Feb 2024 14:19:40 -0800 Subject: [PATCH 5/6] 19044 - remove comment --- tests/unit/AmalgamationShareStructure.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/AmalgamationShareStructure.spec.ts b/tests/unit/AmalgamationShareStructure.spec.ts index 24bb41605..eafc91dd0 100644 --- a/tests/unit/AmalgamationShareStructure.spec.ts +++ b/tests/unit/AmalgamationShareStructure.spec.ts @@ -29,7 +29,6 @@ for (const test of amalgamationRegularBusinessInfo) { AmalgamationShareStructure, null, { - // *** FUTURE: add tests for regular vs short-form amalgamations entityType: test.entityType, tombstone: { keycloakRoles: ['staff'] } }, From e2bb1abb1d1001190f3f0ea64a60efefd93bceaf Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Wed, 14 Feb 2024 14:22:04 -0800 Subject: [PATCH 6/6] 19044 - update package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9263e8d97..763b6857d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.9.1", + "version": "5.9.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.9.1", + "version": "5.9.2", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.0.19", diff --git a/package.json b/package.json index eb3141cfa..a119cc53c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "5.9.1", + "version": "5.9.2", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components",