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

18369 agm extension evaluation #573

Merged
merged 20 commits into from
Nov 14, 2023
Merged
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.7",
"version": "7.0.8",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
40 changes: 37 additions & 3 deletions src/components/AgmExtension/AgmExtensionEvaluation.vue
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

<template #content>
<v-card
v-if="!data.isEligible"
outlined
class="message-box rounded-0 mt-6 mx-6"
>
@@ -33,7 +34,7 @@
cols="12"
sm="9"
>
{{ data.agmYear || '' }}
{{ data.agmYear }}
</v-col>
</v-row>

@@ -51,7 +52,21 @@
cols="12"
sm="9"
>
{{ data.extensionDuration || 'Unknown' }}
<template v-if="!data.isEligible">
<template v-if="data.alreadyExtended && !data.requestExpired">
The business has reached maximum possible extension for this AGM.
</template>
<template v-else-if="!data.alreadyExtended && data.requestExpired">
The period to request an extension for this AGM has expired.
</template>
<template v-else-if="data.alreadyExtended && data.requestExpired">
The business has reached maximum possible extension for this AGM.
The period to request an extension has expired.
</template>
</template>
<template v-else>
{{ data.extensionDuration }} months
</template>
</v-col>
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
</v-row>

@@ -69,7 +84,21 @@
cols="12"
sm="9"
>
{{ data.agmDueDate || 'Unknown' }}
<template v-if="!data.isEligible">
<template v-if="data.alreadyExtended && !data.requestExpired">
The due date for this AGM cannot be set since extension has already been requested.
</template>
<template v-else-if="!data.alreadyExtended && data.requestExpired">
The due date for this AGM cannot be set since the request for extension has expired.
</template>
<template v-else-if="data.alreadyExtended && data.requestExpired">
The due date for this AGM cannot be set since extension has already been requested and the request
for extension has expired.
</template>
</template>
<template v-else>
{{ dueDateString }}
</template>
</v-col>
</v-row>
</template>
@@ -80,6 +109,7 @@
import { Component, Prop, Vue } from 'vue-property-decorator'
import { VcardTemplate } from '@/components/common'
import { AgmExtEvalIF } from '@/interfaces'
import { DateUtilities } from '@/services'

@Component({
components: {
@@ -88,5 +118,9 @@ import { AgmExtEvalIF } from '@/interfaces'
})
export default class AgmExtensionEvaluation extends Vue {
@Prop({ required: true }) readonly data!: AgmExtEvalIF

get dueDateString (): string {
return (DateUtilities.formatYyyyMmDd(this.data.agmDueDate))
}
}
</script>
4 changes: 4 additions & 0 deletions src/interfaces/agm-ext-eval-interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/** Object that stores AGM Extension evaluation fields. */
export interface AgmExtEvalIF {
alreadyExtended: boolean
requestExpired: boolean
isGoodStanding: boolean
incorporationDate: Date
isFirstAgm: boolean
@@ -15,6 +17,8 @@ export interface AgmExtEvalIF {

/** An empty AGM Extension Evaluation object. Note: don't assign this - make a copy instead. */
export const EmptyAgmExtEval: AgmExtEvalIF = {
alreadyExtended: null,
requestExpired: null,
isGoodStanding: null,
incorporationDate: null,
isFirstAgm: null,
4 changes: 3 additions & 1 deletion tests/unit/AgmExtension.spec.ts
Original file line number Diff line number Diff line change
@@ -200,7 +200,9 @@ describe('AGM Extension view', () => {
incorporationDate: new Date('2000-01-01T08:00:00.000Z'),
isEligible: true,
isFirstAgm: null,
isGoodStanding: true
isGoodStanding: true,
alreadyExtended: null,
requestExpired: null
},
business: {
foundingDate: '2000-01-01T08:00:00.000+00:00',
223 changes: 215 additions & 8 deletions tests/unit/AgmExtensionEvaluation.spec.ts
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import Vue from 'vue'
import Vuetify from 'vuetify'
import { mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
import { useRootStore } from '@/stores'
import AgmExtensionEvaluation from '@/components/AgmExtension/AgmExtensionEvaluation.vue'

Vue.use(Vuetify)

const vuetify = new Vuetify({})
setActivePinia(createPinia())
const rootStore = useRootStore()

describe('ExtensionRequest', () => {
describe('ExtensionEvaluation', () => {
it('displays normally', () => {
// init store
rootStore.keycloakRoles = ['']

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
@@ -36,10 +31,222 @@ describe('ExtensionRequest', () => {
expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-3').text()).toBe('Duration of Extension')
expect(rows.at(1).find('.col-sm-9').text()).toBe('Unknown')
expect(rows.at(1).find('.col-sm-9').text()).toBe('')

expect(rows.at(2).find('.col-sm-3').text()).toBe('Due date for this AGM')
expect(rows.at(2).find('.col-sm-9').text()).toBe('Unknown')
expect(rows.at(2).find('.col-sm-9').text()).toBe('')

wrapper.destroy()
})

it('is eligible', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true,
alreadyExtended: false,
requestExpired: false
}
},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe('months')

expect(rows.at(2).find('.col-sm-9').text()).toBe('')

wrapper.destroy()
})

it('is eligible, setting the already extended and request expired to true', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true,
alreadyExtended: true,
requestExpired: true
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you should pass in extensionDuration and agmDueDate and verify the output of those here.

},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe('months')

expect(rows.at(2).find('.col-sm-9').text()).toBe('')

wrapper.destroy()
})

it('is eligible, setting the already extended to false request expired to true', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true,
alreadyExtended: false,
requestExpired: true
}
},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe('months')

expect(rows.at(2).find('.col-sm-9').text()).toBe('')

wrapper.destroy()
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is essentially the same test as above, since isEligible=True gives the same results regardless of alreadyExtended.


it('is eligible, setting the already extended to true and request expired to false', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true,
alreadyExtended: true,
requestExpired: false
}
},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe('months')

expect(rows.at(2).find('.col-sm-9').text()).toBe('')

wrapper.destroy()
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.


it('is not eligible - already extended', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: false,
alreadyExtended: true,
requestExpired: false
}
},
vuetify
})

severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe(
'The business has reached maximum possible extension for this AGM.')

expect(rows.at(2).find('.col-sm-9').text()).toBe(
'The due date for this AGM cannot be set since extension has already been requested.')

wrapper.destroy()
})

it('is not eligible - request expired', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: false,
alreadyExtended: false,
requestExpired: true
}
},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe(
'The period to request an extension for this AGM has expired.')

expect(rows.at(2).find('.col-sm-9').text()).toBe(
'The due date for this AGM cannot be set since the request for extension has expired.')

wrapper.destroy()
})

it('is not eligible - already extended + request expired', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: false,
alreadyExtended: true,
requestExpired: true
}
},
vuetify
})

const rows = wrapper.findAll('.content .row')

expect(rows.at(0).find('.col-sm-9').text()).toBe('2023')

expect(rows.at(1).find('.col-sm-9').text()).toBe(
'The business has reached maximum possible extension for this AGM. ' +
'The period to request an extension has expired.')

expect(rows.at(2).find('.col-sm-9').text()).toBe(
'The due date for this AGM cannot be set since extension has already been requested ' +
'and the request for extension has expired.')

wrapper.destroy()
})

it('is not eligible yellow-box verification', () => {
// init store

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: false,
alreadyExtended: true,
requestExpired: true
}
},
vuetify
})

const yellowEvalBox = wrapper.find('.message-box')

expect(yellowEvalBox.exists()).toBe(true)

wrapper.destroy()
})
Loading