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

18534 Amalg unit tests + small fixes + more typing #596

Merged
merged 2 commits into from
Dec 1, 2023
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-filings-ui",
"version": "7.0.22",
"version": "7.0.23",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ export default {
effectiveDate: this.apiToUtcString(header.effectiveDate),
filingId: header.filingId,
filingLink: application.filingLink,
filingSubType: data.type,
isFutureEffective: header.isFutureEffective,
name: header.name,
status: header.status,
Expand All @@ -757,7 +758,7 @@ export default {
this.setFilings([filingItem])
},

storeNrData (nr: NameRequestIF, ia: any): void {
storeNrData (nr: NameRequestIF, app: any): void {
// verify that NR is valid
const error = this.isNrInvalid(nr)
if (error) {
Expand All @@ -773,7 +774,7 @@ export default {

// if IA is not yet completed, check if NR is consumable
// (once IA is completed, NR state will be CONSUMED)
if (ia.filing.header.status !== FilingStatus.COMPLETED) {
if (app.filing.header.status !== FilingStatus.COMPLETED) {
const nrState = this.getNrState(nr) as NameRequestStates
if (nrState !== NameRequestStates.APPROVED && nrState !== NameRequestStates.CONDITIONAL) {
this.nameRequestInvalidDialog = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@
>
<h4>Amalgamation Complete</h4>

<!-- *** TODO: ask Yui what this should look like -->
<!-- <p>
{{ getLegalName || 'A Numbered Benefit Company' }} has been successfully incorporated.
</p> -->
<p>
{{ companyName }} has been successfully incorporated.
</p>

<p>
Return to My Business Registry to access your business and file changes.
Expand Down Expand Up @@ -85,6 +84,7 @@ export default class AmalgamationFiling extends Vue {
@Prop({ required: true }) readonly filing!: ApiFilingIF
@Prop({ required: true }) readonly index!: number

@Getter(useBusinessStore) getEntityName!: string
@Getter(useBusinessStore) getLegalName!: string
@Getter(useConfigurationStore) getMyBusinessRegistryUrl!: string

Expand All @@ -111,6 +111,13 @@ export default class AmalgamationFiling extends Vue {
)
}

/** The legal name or numbered description of the new company. */
get companyName (): string {
if (this.getLegalName) return this.getLegalName
if (this.getEntityName) return `A ${this.getEntityName}`
return 'Unknown Name'
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the same as for Incorporation Applications.


returnToMyBusinessRegistry (): void {
navigate(this.getMyBusinessRegistryUrl)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<h4>Incorporation Complete</h4>

<p>
{{ getLegalName || 'A Numbered Benefit Company' }} has been successfully incorporated.
{{ companyName }} has been successfully incorporated.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great catch Sev! Removing that hard-coded part.

</p>

<p>
Expand Down Expand Up @@ -84,6 +84,7 @@ export default class IncorporationApplication extends Vue {
@Prop({ required: true }) readonly filing!: ApiFilingIF
@Prop({ required: true }) readonly index!: number

@Getter(useBusinessStore) getEntityName!: string
@Getter(useBusinessStore) getLegalName!: string
@Getter(useConfigurationStore) getMyBusinessRegistryUrl!: string

Expand All @@ -110,6 +111,13 @@ export default class IncorporationApplication extends Vue {
)
}

/** The legal name or numbered description of the new company. */
get companyName (): string {
if (this.getLegalName) return this.getLegalName
if (this.getEntityName) return `A ${this.getEntityName}`
return 'Unknown Name'
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a fix! Ie,

image


returnToMyBusinessRegistry (): void {
navigate(this.getMyBusinessRegistryUrl)
}
Expand Down
1 change: 1 addition & 0 deletions src/enums/allowableActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum AllowableActions {
ADMINISTRATIVE_DISSOLUTION,
AGM_EXTENSION,
AGM_LOCATION_CHANGE,
AMALGAMATION,
ANNUAL_REPORT,
BUSINESS_INFORMATION,
BUSINESS_SUMMARY,
Expand Down
3 changes: 2 additions & 1 deletion src/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export * from './affiliationInvitation'

// external enums
export { CorpTypeCd, CorpClass } from '@bcrs-shared-components/corp-type-module'
export { AccountTypes, FilingCodes, FilingNames, FilingTypes, StaffPaymentOptions } from '@bcrs-shared-components/enums'
export { AccountTypes, AmalgamationTypes, FilingCodes, FilingNames, FilingTypes, StaffPaymentOptions }
from '@bcrs-shared-components/enums'
8 changes: 5 additions & 3 deletions src/mixins/allowable-actions-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { GetFeatureFlag } from '@/utils'
import { AllowableActions, CorpTypeCd, FilingSubTypes, FilingTypes } from '@/enums'
import { AllowedActionsIF } from '@/interfaces'
import { useBusinessStore, useRootStore } from '@/stores'
import { LoginSource } from 'sbc-common-components/src/util/constants'

@Component({})
export default class AllowableActionsMixin extends Vue {
Expand All @@ -15,7 +14,6 @@ export default class AllowableActionsMixin extends Vue {
@Getter(useBusinessStore) isSoleProp!: boolean
@Getter(useBusinessStore) isGoodStanding!: boolean
@Getter(useRootStore) isRoleStaff!: boolean
@Getter(useRootStore) getUserInfo!: any

/**
* Returns True if the specified action is allowed, else False.
Expand Down Expand Up @@ -49,6 +47,10 @@ export default class AllowableActionsMixin extends Vue {
return this.isAllowedFiling(FilingTypes.AGM_LOCATION_CHANGE)
}

case AllowableActions.AMALGAMATION: {
return this.isAllowedFiling(FilingTypes.AMALGAMATION)
}

case AllowableActions.BUSINESS_INFORMATION: {
if (this.isCoop) {
// NB: this feature is targeted via LaunchDarkly
Expand Down Expand Up @@ -99,7 +101,7 @@ export default class AllowableActionsMixin extends Vue {
// NB: this feature is targeted via LaunchDarkly
const ff = !!GetFeatureFlag('enable-digital-credentials')
const isDigitalBusinessCardAllowed = this.getAllowedActions?.digitalBusinessCard
return ff && isDigitalBusinessCardAllowed
return (ff && isDigitalBusinessCardAllowed)
}

case AllowableActions.DIRECTOR_CHANGE: {
Expand Down
56 changes: 28 additions & 28 deletions src/stores/businessStore.ts
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just reorganized some of the getters in here.

Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,23 @@ export const useBusinessStore = defineStore('business', {
},

/** Is True if entity is a Benefit Company. */
isBComp (state: BusinessStateIF): boolean {
return (state.businessInfo.legalType === CorpTypeCd.BENEFIT_COMPANY)
isBComp (): boolean {
return (this.getLegalType === CorpTypeCd.BENEFIT_COMPANY)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

... And I used the getter for legal type instead of extracting it from the state.

},

/** Is True if entity is a BC Company. */
isBcCompany (state: BusinessStateIF): boolean {
return (state.businessInfo.legalType === CorpTypeCd.BC_COMPANY)
isBcCompany (): boolean {
return (this.getLegalType === CorpTypeCd.BC_COMPANY)
},

/** Is True if entity is a BC Community Contribution Company. */
isCcc (): boolean {
return (this.getLegalType === CorpTypeCd.BC_CCC)
},

/** Is True if entity is a BC ULC Company. */
isUlc (): boolean {
return (this.getLegalType === CorpTypeCd.BC_ULC_COMPANY)
},

/** Is True if entity is a BEN/BC/CCC/ULC. */
Expand All @@ -161,19 +171,24 @@ export const useBusinessStore = defineStore('business', {
)
},

/** Is True if entity is a BC Community Contribution Company. */
isCcc (state: BusinessStateIF): boolean {
return (state.businessInfo.legalType === CorpTypeCd.BC_CCC)
/** Is True if entity is a Cooperative. */
isCoop (): boolean {
return (this.getLegalType === CorpTypeCd.COOP)
},

/** Is True if entity is a Cooperative. */
isCoop (state: BusinessStateIF): boolean {
return (state.businessInfo.legalType === CorpTypeCd.COOP)
/** Is True if entity is a Corporation. */
isCorp (): boolean {
return (this.getLegalType === CorpTypeCd.CORPORATION)
},

/** Is True if entity is a General Partnership. */
isPartnership (): boolean {
return (this.getLegalType === CorpTypeCd.PARTNERSHIP)
},

/** Is True if entity is a BC Corporation. */
isCorp (state: BusinessStateIF): boolean {
return (state.businessInfo.legalType === CorpTypeCd.CORPORATION)
/** Is True if entity is a Sole Proprietorship. */
isSoleProp (): boolean {
return (this.getLegalType === CorpTypeCd.SOLE_PROP)
},

/** Is True if entity is a Sole Proprietorship or General Partnership. */
Expand All @@ -194,21 +209,6 @@ export const useBusinessStore = defineStore('business', {
/** Is True if business is in liquidation. */
isLiquidation (): boolean {
return (this.getBusinessState === EntityState.LIQUIDATION)
},

/** Is True if entity is a General Partnership. */
isPartnership (): boolean {
return (this.getLegalType === CorpTypeCd.PARTNERSHIP)
},

/** Is True if entity is a Sole Proprietorship. */
isSoleProp (): boolean {
return (this.getLegalType === CorpTypeCd.SOLE_PROP)
},

/** Is True if entity is a BC ULC Company. */
isUlc (): boolean {
return (this.getLegalType === CorpTypeCd.BC_ULC_COMPANY)
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/stores/filingHistoryListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const useFilingHistoryListStore = defineStore('filingHistoryList', {

// check if we're opening a new panel
if (!isCurrentPanel) {
// get a reference to the filing so we can update it right in the main list
// get a reference to the filing so we can update it right in the main list
const filing = this.getFilings[index]

// check if we're missing comments or documents
Expand Down
1 change: 0 additions & 1 deletion tests/unit/AgmExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ describe('AGM Extension view', () => {
})

// simulate eligible data and valid component
// *** TODO: add more data here and below when verifying payload
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not needed.

wrapper.setData({
data: { isEligible: true },
extensionRequestValid: true
Expand Down
61 changes: 61 additions & 0 deletions tests/unit/AmalgamationFiling.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Vue from 'vue'
import Vuetify from 'vuetify'
import { Wrapper, mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
import { useBusinessStore } from '@/stores'
import { FilingStatus, FilingTypes } from '@/enums'
import AmalgamationFiling from '@/components/Dashboard/FilingHistoryList/filings/AmalgamationFiling.vue'

// mock the console.warn function to hide "[Vuetify] The v-expansion-panel component must be used inside a
// v-expansion-panels"
console.warn = vi.fn()

Vue.use(Vuetify)

const vuetify = new Vuetify({})
setActivePinia(createPinia())
const businessStore = useBusinessStore()

describe('Amalgamation Filing', () => {
let wrapper: Wrapper<AmalgamationFiling>

beforeAll(() => {
// init store
businessStore.setLegalName('MY COMPANY')

wrapper = mount(AmalgamationFiling, {
vuetify,
propsData: {
filing: {
comments: [],
commentsCount: 0,
commentsLink: null,
displayName: 'Amalgamation Application - Regular',
documents: [],
documentsLink: 'dummy_link',
data: {},
effectiveDate: new Date('2021-01-01 08:00:00 GMT'),
name: FilingTypes.AMALGAMATION,
status: FilingStatus.COMPLETED,
submittedDate: new Date('2021-01-01 08:00:00 GMT'),
submitter: 'John Doe'
},
index: 0
}
})
})

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

it('Displays expected content with a valid filing', () => {
// verify content
expect(wrapper.find('.item-header-title').text()).toBe('Amalgamation Application - Regular')
expect(wrapper.find('.item-header-subtitle').text()).toContain('FILED AND PAID')
expect(wrapper.find('.item-header-subtitle').text()).toContain('(filed by John Doe on Jan 1, 2021)')
expect(wrapper.find('.item-header-subtitle').text()).toContain('EFFECTIVE as of Jan 1, 2021')

// FUTURE: expand the panel and verify content
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried for a while to be able to expand this item and verify the content but was unable.

})
})
Loading
Loading