diff --git a/package-lock.json b/package-lock.json index cdee9f150..ddbdee3de 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", 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 eecde456b..350262d3b 100644 --- a/tests/unit/AmalgamationInformation.spec.ts +++ b/tests/unit/AmalgamationInformation.spec.ts @@ -1,7 +1,6 @@ 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 +8,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 +23,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 +32,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 +68,91 @@ 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', () => { + 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..a16074353 100644 --- a/tests/unit/AmalgamationPeopleRoles.spec.ts +++ b/tests/unit/AmalgamationPeopleRoles.spec.ts @@ -2,9 +2,10 @@ 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 = [ +const amalgamationBusinessInfo = [ { entityType: 'BEN' }, @@ -19,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 @@ -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,10 @@ 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}`, () => { + /** + * Unit tests for Vertical will be similar to the test below + */ + describe(`Amalgamation-Short People and Roles for a ${test.entityType}`, () => { let wrapper: any beforeAll(() => { @@ -60,8 +65,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/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'] } }, 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() + }) +})