Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19044 - Amalgamation unit tests #655

Merged
merged 8 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/AmalgamatingBusinesses.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ describe('Amalgamating Businesses - components and validity', () => {
})

it('computes havePrimaryBusiness correctly', () => {
// verify with no holding businesses
// verify with no primary businesses
Copy link
Collaborator Author

@ketaki-deodhar ketaki-deodhar Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated comment based on test. Same below.

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
]
Expand Down
97 changes: 92 additions & 5 deletions tests/unit/AmalgamationInformation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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'
import BusinessTypeHelp from '@/components/Amalgamation/BusinessTypeHelp.vue'
import { AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums'

// Test Case Data
const amalgamationRegularBusinessInfo = [
const amalgamationBusinessInfo = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed as can be used for regular and short tests

{
entityType: 'BEN'
},
Expand All @@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -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)
})
})
}
22 changes: 15 additions & 7 deletions tests/unit/AmalgamationPeopleRoles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand All @@ -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

Expand All @@ -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
Expand All @@ -50,18 +54,22 @@ 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(() => {
wrapper = shallowWrapperFactory(
AmalgamationPeopleRoles,
null,
{
amalgamation: { type: AmalgamationTypes.HORIZONTAL },
entityType: test.entityType,
tombstone: { keycloakRoles: ['staff'] }
tombstone: {
filingType: FilingTypes.AMALGAMATION_APPLICATION,
keycloakRoles: ['staff'] }
},
null,
AmalgamationShortResources
Expand Down
100 changes: 95 additions & 5 deletions tests/unit/AmalgamationReviewConfirm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand All @@ -28,18 +29,21 @@ const amalgamationRegularBusinessInfo = [
}
]

for (const test of amalgamationRegularBusinessInfo) {
describe(`Amalgamation-Regular Review Confirm for a ${test.entityType}`, () => {
for (const test of amalgamationBusinessInfo) {
Copy link
Collaborator Author

@ketaki-deodhar ketaki-deodhar Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests for Review and confirm are similar Regular vs Short. UIs are different for Staff vs regular user so added test at line 133

describe(`Amalgamation-Regular Review Confirm for a ${test.entityType} as Staff`, () => {
let wrapper: any

beforeAll(() => {
wrapper = shallowWrapperFactory(
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
Expand Down Expand Up @@ -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)
})
})
}
1 change: 0 additions & 1 deletion tests/unit/AmalgamationShareStructure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }
},
Expand Down
Loading
Loading