Skip to content

Commit

Permalink
Added unit tests for amalgamation views + lots of misc. fixes and cle…
Browse files Browse the repository at this point in the history
…anup
  • Loading branch information
JazzarKarim committed Jan 3, 2024
1 parent dc7f2b0 commit ac6b8e9
Show file tree
Hide file tree
Showing 35 changed files with 416 additions and 37 deletions.
4 changes: 3 additions & 1 deletion src/components/Incorporation/IncorporationDateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
sm="3"
class="pr-4"
>
<label>Incorporation Date and Time</label>
<label>{{ label }}</label>
</v-col>

<v-col
Expand Down Expand Up @@ -165,6 +165,8 @@ export default class IncorporationDateTime extends Mixins(DateMixin) {
@Prop({ default: null }) readonly effectiveDateTime!: EffectiveDateTimeIF
@Prop({ default: 'Incorporation Date and Time' }) readonly label!: string
// Local properties
isImmediate = false
isFutureEffective = false
Expand Down
2 changes: 1 addition & 1 deletion src/views/AmalgamationRegular/PeopleRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class AmalgamationRegularPeopleRoles extends Mixins(CommonMixin)
@Watch('$route')
private async scrollToInvalidComponent (): Promise<void> {
if (this.getShowErrors && this.$route.name === RouteNames.INCORPORATION_PEOPLE_ROLES) {
if (this.getShowErrors && this.$route.name === RouteNames.AMALG_REG_PEOPLE_ROLES) {
// scroll to invalid components
await this.$nextTick()
await this.validateAndScroll(
Expand Down
8 changes: 4 additions & 4 deletions src/views/AmalgamationRegular/ReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<!-- Amalgamating Businesses Information -->
<v-card
id="people-and-roles-vcard"
id="amalgamating-businesses-information-vcard"
flat
class="mt-6"
>
Expand Down Expand Up @@ -101,6 +101,7 @@
class="mt-6"
:class="{ 'invalid-section': isEffectiveDateTimeInvalid }"
:effectiveDateTime="getEffectiveDateTime"
label="Amalgamation Date and Time"
@valid="setEffectiveDateTimeValid($event)"
@effectiveDate="setEffectiveDate($event)"
@isFutureEffective="setIsFutureEffective($event)"
Expand All @@ -115,7 +116,7 @@
<header>
<h2>Document Delivery</h2>
<p class="mt-4">
Copies of the incorporation documents will be sent to the email addresses listed below.
Copies of the amalgamation documents will be sent to the email addresses listed below.
</p>
</header>

Expand Down Expand Up @@ -272,7 +273,7 @@
import { Component, Vue } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { useStore } from '@/store/store'
import { ContactPointIF, CertifyIF, EffectiveDateTimeIF, IncorporationAgreementIF, ShareStructureIF,
import { ContactPointIF, CertifyIF, EffectiveDateTimeIF, ShareStructureIF,
CourtOrderStepIF } from '@/interfaces'
import CardHeader from '@/components/common/CardHeader.vue'
import Certify from '@/components/common/Certify.vue'
Expand Down Expand Up @@ -312,7 +313,6 @@ export default class AmalgamationRegularReviewConfirm extends Vue {
@Getter(useStore) getEntityType!: CorpTypeCd
@Getter(useStore) getFolioNumber!: string
@Getter(useStore) getFolioNumberValid!: boolean
@Getter(useStore) getIncorporationAgreementStep!: IncorporationAgreementIF
@Getter(useStore) getUserEmail!: string
@Getter(useStore) getValidateSteps!: boolean
@Getter(useStore) isPremiumAccount!: boolean
Expand Down
15 changes: 9 additions & 6 deletions src/views/AmalgamationRegular/ShareStructure.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h2>1. Create Your Authorized Share Structure</h2>
</header>

<p id="incorporation-share-structure">
<p id="amalgamation-regular-share-structure">
Add at least one class of shares. A share class consists of the name of the class, the
maximum number of shares in the class (including any associated Series), a par value for
the class, and the currency the shares are valued in.
Expand Down Expand Up @@ -35,7 +35,7 @@
</header>

<p>
An incorporated business must issue shares. These shares represent ownership interest in
An amalgamated business must issue shares. These shares represent ownership interest in
the company and give the shareholder a say in how the company is being run. For most
small companies starting out, a simple share structure with just one class of shares (and
no series) is typical.
Expand Down Expand Up @@ -66,12 +66,15 @@
The staff at the Corporate Registry cannot provide advice on how to set up your company's
share structure. If you do not understand what an authorized share structure is or what
its purpose is or believe you need a more complex share structure, you should seek
professional advice or purchase an incorporation guide for detailed information and
professional advice or purchase an amalgamation guide for detailed information and
infrastructure on establishing an authorized share structure.
</p>
<!--
Need to double check if this is changed.
<p>
Refer to this <a :href="helpLink">link</a> to obtain more information on incorporating a company.
</p>
-->
<u
class="help-btn"
@click="helpToggle = !helpToggle"
Expand Down Expand Up @@ -316,14 +319,14 @@ export default class AmalgamationRegularShareStructure extends Mixins(CommonMixi
@Watch('$route')
private async scrollToInvalidComponent (): Promise<void> {
if (this.getShowErrors && this.$route.name === RouteNames.INCORPORATION_SHARE_STRUCTURE) {
if (this.getShowErrors && this.$route.name === RouteNames.AMALG_REG_SHARE_STRUCTURE) {
// scroll to invalid components
await this.$nextTick()
await this.validateAndScroll(
{
shareStructure: this.getCreateShareStructureStep.valid
},
['incorporation-share-structure']
['amalgamation-regular-share-structure']
)
}
}
Expand All @@ -349,7 +352,7 @@ li {
padding-top: 0.25rem;
}
p{
p {
padding-top: 0.5rem;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/AgreementType.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import { wrapperFactory } from '../jest-wrapper-factory'
import { wrapperFactory } from '../vitest-wrapper-factory'
import AgreementType from '@/components/common/AgreementType.vue'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module'

Expand Down
60 changes: 60 additions & 0 deletions tests/unit/AmalgRegBusinessInfo.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { shallowWrapperFactory } from '../vitest-wrapper-factory'
import { AmalgRegBusinessInfo } from '@/views'
import { AmalgamationRegResources } from '@/resources/'
import OfficeAddresses from '@/components/common/OfficeAddresses.vue'
import BusinessContactInfo from '@/components/common/BusinessContactInfo.vue'

// Test Case Data
const amalgamationRegularBusinessInfo = [
{
entityType: 'BEN'
},
{
entityType: 'BC'
},
{
entityType: 'ULC'
},
{
entityType: 'CC'
}
]

for (const test of amalgamationRegularBusinessInfo) {
describe(`Amalgamation Regular Business Information for a ${test.entityType}`, () => {
let wrapper: any

beforeAll(() => {
wrapper = shallowWrapperFactory(
AmalgRegBusinessInfo,
null,
{
entityType: test.entityType,
tombstone: { keycloakRoles: ['staff'] }
},
null,
AmalgamationRegResources
)
})

afterAll(() => {
wrapper.destroy()
})

it('renders the page', () => {
expect(wrapper.find('#amalgamation-regular-business-info').exists()).toBe(true)
})

it('displays Registered and Records Office Addresses section', () => {
const section = wrapper.findAll('section').at(0)
expect(section.find('header h2').text()).toBe('Registered and Records Office Addresses')
expect(section.findComponent(OfficeAddresses).exists()).toBe(true)
})

it('displays Registered Office Contact Information section', () => {
const section = wrapper.findAll('section').at(1)
expect(section.find('header h2').text()).toBe('Registered Office Contact Information')
expect(wrapper.findComponent(BusinessContactInfo).exists()).toBe(true)
})
})
}
65 changes: 65 additions & 0 deletions tests/unit/AmalgRegInformation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { shallowWrapperFactory } from '../vitest-wrapper-factory'
import { AmalgRegInformation } from '@/views'
import { AmalgamationRegResources } 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'

// Test Case Data
const amalgamationRegularBusinessInfo = [
{
entityType: 'BEN'
},
{
entityType: 'BC'
},
{
entityType: 'ULC'
},
{
entityType: 'CC'
}
]

for (const test of amalgamationRegularBusinessInfo) {
describe(`Amalgamation Regular Business Information for a ${test.entityType}`, () => {
let wrapper: any

beforeAll(() => {
wrapper = shallowWrapperFactory(
AmalgRegInformation,
null,
{
entityType: test.entityType,
tombstone: { keycloakRoles: ['staff'] }
},
null,
AmalgamationRegResources
)
})

afterAll(() => {
wrapper.destroy()
})

it('renders the page', () => {
expect(wrapper.find('#amalgamation-regular-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 amalgamating businesses to the list.')
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(ExpandableHelp).exists()).toBe(true)
expect(section.findComponent(BusinessTypeHelp).exists()).toBe(true)
expect(section.findComponent(ResultingBusinessName).exists()).toBe(true)
})
})
}
52 changes: 52 additions & 0 deletions tests/unit/AmalgRegPeopleRoles.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { shallowWrapperFactory } from '../vitest-wrapper-factory'
import { AmalgRegPeopleRoles } from '@/views'
import { AmalgamationRegResources } from '@/resources/'
import PeopleAndRoles from '@/components/common/PeopleAndRoles.vue'

// Test Case Data
const amalgamationRegularBusinessInfo = [
{
entityType: 'BEN'
},
{
entityType: 'BC'
},
{
entityType: 'ULC'
},
{
entityType: 'CC'
}
]

for (const test of amalgamationRegularBusinessInfo) {
describe(`Amalgamation Regular Business Information for a ${test.entityType}`, () => {
let wrapper: any

beforeAll(() => {
wrapper = shallowWrapperFactory(
AmalgRegPeopleRoles,
null,
{
entityType: test.entityType,
tombstone: { keycloakRoles: ['staff'] }
},
null,
AmalgamationRegResources
)
})

afterAll(() => {
wrapper.destroy()
})

it('renders the page', () => {
expect(wrapper.find('#amalgamation-regular-people-roles').exists()).toBe(true)
})

it('displays the header and renders the People and Roles component correctly', () => {
expect(wrapper.find('header h2').text()).toBe('1. Add People to your Application')
expect(wrapper.findComponent(PeopleAndRoles).exists()).toBe(true)
})
})
}
Loading

0 comments on commit ac6b8e9

Please sign in to comment.