-
Notifications
You must be signed in to change notification settings - Fork 49
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
Changes from 5 commits
6dd8928
81eed4b
fc38aac
b805077
a206f71
b3e757f
b21cd28
e2bb1ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { shallowWrapperFactory } from '../vitest-wrapper-factory' | ||
import { AmalgamationInformation } from '@/views' | ||
// *** FUTURE: add tests for AmalgamationShortResources | ||
severinbeauvais marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renamed as can be used for regular and short tests |
||
{ | ||
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,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) | ||
}) | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,18 +29,21 @@ const amalgamationRegularBusinessInfo = [ | |
} | ||
] | ||
|
||
for (const test of amalgamationRegularBusinessInfo) { | ||
describe(`Amalgamation-Regular Review Confirm for a ${test.entityType}`, () => { | ||
for (const test of amalgamationBusinessInfo) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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) | ||
}) | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
}) | ||
}) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a few tests for Short amalgamation (it is a bit of a different case than other filings) |
||
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() | ||
}) | ||
}) |
There was a problem hiding this comment.
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.