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
Show file tree
Hide file tree
Changes from 5 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.5",
"version": "7.0.6",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
32 changes: 29 additions & 3 deletions src/components/AgmExtension/AgmExtensionEvaluation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

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

Expand All @@ -48,10 +49,18 @@
<strong>Duration of Extension</strong>
</v-col>
<v-col
v-if="!data.isEligible"
cols="12"
sm="9"
>
{{ data.extensionDuration || 'Unknown' }}
{{ extensionDurationText }}
</v-col>
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
<v-col
v-else
cols="12"
sm="9"
>
{{ data.extensionDuration }} months
</v-col>
</v-row>

Expand All @@ -66,10 +75,18 @@
<strong>Due date for this AGM</strong>
</v-col>
<v-col
v-if="!data.isEligible"
cols="12"
sm="9"
>
{{ dueDateText }}
</v-col>
<v-col
v-else
cols="12"
sm="9"
>
{{ data.agmDueDate || 'Unknown' }}
{{ dueDateString }}
</v-col>
</v-row>
</template>
Expand All @@ -80,6 +97,7 @@
import { Component, Prop, Vue } from 'vue-property-decorator'
import { VcardTemplate } from '@/components/common'
import { AgmExtEvalIF } from '@/interfaces'
import { DateUtilities } from '@/services'

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

@Prop({ default: '' }) readonly extensionDurationText!: string

@Prop({ default: '' }) readonly dueDateText!: string
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved

get dueDateString (): string {
return (DateUtilities.formatYyyyMmDd(this.data.agmDueDate))
}
}
</script>
4 changes: 3 additions & 1 deletion src/interfaces/agm-ext-eval-interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** Object that stores AGM Extension evaluation fields. */
export interface AgmExtEvalIF {
isEligible: boolean
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
isGoodStanding: boolean
incorporationDate: Date
isFirstAgm: boolean
Expand All @@ -14,10 +15,11 @@ export interface AgmExtEvalIF {

/** An empty AGM Extension Evaluation object. Note: don't assign this - make a copy instead. */
export const EmptyAgmExtEval: AgmExtEvalIF = {
isEligible: null,
isGoodStanding: null,
incorporationDate: null,
isFirstAgm: null,
agmYear: null,
extensionDuration: NaN,
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
extensionDuration: null,
agmDueDate: null
}
2 changes: 2 additions & 0 deletions src/views/AgmExtension.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
<AgmExtensionEvaluation
class="mt-8"
:data.sync="data"
:extensionDurationText="''"
:dueDateText="''"
/>

<!-- delete this debugging code -->
Expand Down
89 changes: 86 additions & 3 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
Expand Up @@ -11,7 +11,7 @@ const vuetify = new Vuetify({})
setActivePinia(createPinia())
const rootStore = useRootStore()

describe('ExtensionRequest', () => {
describe('ExtensionEvaluation', () => {
it('displays normally', () => {
// init store
rootStore.keycloakRoles = ['']
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -36,10 +36,93 @@ 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
rootStore.keycloakRoles = ['']

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true
},
extensionDurationText: '',
dueDateText: ''
},
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 extensionDurationText and dueDateText', () => {
// init store
rootStore.keycloakRoles = ['']

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: true
},
extensionDurationText: '6 months',
dueDateText: 'December 2, 2023'
},
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', () => {
// init store
rootStore.keycloakRoles = ['']

const wrapper = mount(AgmExtensionEvaluation, {
propsData: {
data: {
agmYear: 2023,
isEligible: false
},
extensionDurationText: 'The business has reached maximum possible extension for this AGM.',
dueDateText: 'The business is overdue for this AGM and extension cannot be requested.'
},
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 business is overdue for this AGM and extension cannot be requested.')

wrapper.destroy()
})
Expand Down
Loading