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

Bug fix - To do Draft for Voluntary Dissolution #56

Merged
merged 2 commits into from
Oct 25, 2024
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
54 changes: 53 additions & 1 deletion cypress/e2e/components/todos/draft.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DraftFilingIncorporationApplicationNumbered } from '../../../fixtures/filings/draft/incorporation-applicaton'

context('TODOs -> Draft Filing', () => {
it('Test draft filing to-do item - base case (draft with no error)', () => {
it('Test draft filing to-do item - base case (draft with no error) - change of registration', () => {
cy.visitBusinessDashFor('businessInfo/ben/active.json', undefined, false, false, 'draft/changeOfRegistration.json')

cy.get('[data-cy="header_todo"]').should('exist')
Expand Down Expand Up @@ -53,6 +53,58 @@ context('TODOs -> Draft Filing', () => {
.get('[data-cy="bcros-dialog"]').should('not.exist')
})

it('Test draft filing to-do item - base case (draft with no error) - voluntary dissolution', () => {
cy.visitBusinessDashFor('businessInfo/ben/active.json', undefined, false, false, 'draft/voluntaryDissolution.json')

cy.get('[data-cy="header_todo"]').should('exist')
cy.get('[data-cy="todoItemList"]').should('exist')

// subtitle
cy.get('[data-cy^="todoItem-label-"]').should('exist').contains('DRAFT')

// View More button should not exist
cy.get('[data-cy^="todoItem-showMore-"]').should('not.exist')

cy.get('[data-cy^="todoItemActions-"]').should('exist').as('actionSection')

// The action button should exist
cy.get('@actionSection')
.find('button')
.should('exist')
.should('have.text', 'Resume')

// The dropdown menu should exist
cy.get('@actionSection')
.find('[data-cy="popover-button"]')
.should('exist')
.click() // open the dropdown menu

// The delete button should exist in the dropdown menu
// click the button to open the dialog
cy.get('@actionSection')
.find('[data-cy="menu-button-0"]')
.should('exist')
.should('have.text', 'Delete Voluntary Dissolution')
.click()
.get('[data-cy="bcros-dialog-confirm"]').should('exist').as('dialog')

// verify the dialog content
// click the cancel button to close the dialog
cy.get('@dialog').find('h1').should('have.text', 'Delete Draft?')
cy.get('@dialog')
.find('[data-cy="bcros-dialog-text"]')
.find('p')
.should('have.text', 'Delete your Dissolution? Any changes you\'ve made will be lost.')
cy.get('@dialog')
.find('[data-cy="bcros-dialog-btn"]').should('have.length', 2)
.eq(0).should('have.text', 'Delete')
cy.get('@dialog')
.find('[data-cy="bcros-dialog-btn"]')
.eq(1).should('have.text', 'Cancel')
.click()
.get('[data-cy="bcros-dialog"]').should('not.exist')
})

it('Test draft filing to-do item - Incomplete payment', () => {
cy.visitBusinessDashFor('businessInfo/ben/active.json', undefined, false, false, 'draft/incompletePayment.json')

Expand Down
106 changes: 106 additions & 0 deletions cypress/fixtures/todos/draft/voluntaryDissolution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"tasks": [
{
"enabled": true,
"order": 1,
"task": {
"filing": {
"business": {
"foundingDate": "2024-10-12T00:27:29.366345+00:00",
"identifier": "BC0883617",
"legalName": "0883617 B.C. LTD.",
"legalType": "BC"
},
"dissolution": {
"affidavitConfirmed": false,
"custodialOffice": {
"deliveryAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "delivery",
"deliveryInstructions": "",
"id": 2926487,
"postalCode": "V8W 3E6",
"streetAddress": "200-940 Blanshard St",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "mailing",
"deliveryInstructions": "",
"id": 2926486,
"postalCode": "V8W 3E6",
"streetAddress": "200-940 Blanshard St",
"streetAddressAdditional": ""
}
},
"dissolutionDate": "2024-10-24",
"dissolutionType": "voluntary",
"parties": [
{
"deliveryAddress": {
"addressCity": "",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "",
"streetAddress": "",
"streetAddressAdditional": ""
},
"inheritMailingAddress": false,
"mailingAddress": {
"addressCity": "",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "",
"streetAddress": "",
"streetAddressAdditional": ""
},
"officer": {
"firstName": "",
"id": null,
"lastName": "",
"middleName": "",
"organizationName": "",
"partyType": null
},
"roles": [
{
"appointmentDate": "2024-10-24",
"roleType": "Custodian"
}
]
}
],
"resolution": {
"resolutionConfirmed": false
}
},
"header": {
"affectedFilings": [],
"availableOnPaperOnly": false,
"certifiedBy": "",
"colinIds": [],
"comments": [],
"date": "2024-10-25T00:04:54.570499+00:00",
"deletionLocked": false,
"documentOptionalEmail": "[email protected]",
"effectiveDate": "2024-10-25T00:04:54.570521+00:00",
"filingId": 151624,
"inColinOnly": false,
"isCorrected": false,
"isCorrectionPending": false,
"isFutureEffective": false,
"name": "dissolution",
"status": "DRAFT",
"submitter": "pewang@idir"
}
}
}
}
]
}
16 changes: 8 additions & 8 deletions src/utils/todo/task-filing/button-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ const showDeleteOnly = (todoItem: TodoItemI): boolean => {
const business = useBcrosBusiness()
const { isStaffAccount } = useBcrosAccount()
const filingType = todoItem.name
if (filingType === FilingTypes.ALTERATION || filingType === FilingTypes.DISSOLUTION) {
// Alteration filing draft and Dissolution filing draft can only be deleted
return true
} else if (filingType === FilingTypes.SPECIAL_RESOLUTION) {
// if a business is not in good standing, non-staff role can only delete the Special Resolution draft
return business && !business.currentBusiness.goodStanding && !isStaffAccount
} else {
return false

switch (filingType) {
case FilingTypes.ALTERATION:
case FilingTypes.DISSOLUTION:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question, so for delete button show we treat both alteration and dissolution as if it is special resolution ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. The switch statement is copied from the old codebase. I misunderstood the logic before.

case FilingTypes.SPECIAL_RESOLUTION:
return business && !business.currentBusiness.goodStanding && !isStaffAccount
default:
return false
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/utils/todo/task-filing/content-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export const getTitle = (filing: TaskToDoI, corpFullDescription: string): string
`${filingTypeToName(filing.correction.correctedFilingType as FilingTypes)}`
return title
case FilingTypes.DISSOLUTION:
// TO-DO: get data from the 'configObject', which is saved in rootStore in the old codebase
return title
return business.businessConfig?.todoList.title
case FilingTypes.INCORPORATION_APPLICATION:
return FilingNames.INCORPORATION_APPLICATION
case FilingTypes.REGISTRATION:
Expand Down
Loading