Skip to content

Commit

Permalink
- changed re-routing code to not push the wrong route to history
Browse files Browse the repository at this point in the history
- deleted useless isViteRunning getter
- fixed amalgamation statement validation (was undefined on draft
  restore)
- update misc comments
  • Loading branch information
Severin Beauvais committed Feb 5, 2024
1 parent bd083c6 commit 5e1590d
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 28 deletions.
20 changes: 10 additions & 10 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
// reset errors in case this method is invoked more than once (ie, retry)
this.resetFlags()
// don't check FF during Vitest tests
if (!this.isVitestRunning) {
// only check FF when not in Vitest tests
if (import.meta.env.VITEST === undefined) {
// check that current route matches a supported filing type
const supportedFilings = await GetFeatureFlag('supported-filings')
if (!supportedFilings?.includes(this.$route.meta.filingType)) {
Expand Down Expand Up @@ -753,31 +753,31 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
switch (this.getFilingType) {
case FilingTypes.AMALGAMATION_APPLICATION:
if (this.isAmalgamationFilingRegular) {
this.$router.push(RouteNames.AMALG_REG_INFORMATION).catch(() => {})
this.$router.replace(RouteNames.AMALG_REG_INFORMATION).catch(() => {})
} else if (this.isAmalgamationFilingHorizontal || this.isAmalgamationFilingVertical) {
this.$router.push(RouteNames.AMALG_SHORT_INFORMATION).catch(() => {})
this.$router.replace(RouteNames.AMALG_SHORT_INFORMATION).catch(() => {})
} else {
throw new Error('invalid amalgamation filing type')
}
return
case FilingTypes.CONTINUATION_IN:
this.$router.push(RouteNames.CONTINUATION_IN_BUSINESS_HOME).catch(() => {})
this.$router.replace(RouteNames.CONTINUATION_IN_BUSINESS_HOME).catch(() => {})
return
case FilingTypes.DISSOLUTION:
if (this.isTypeFirm) {
this.$router.push(RouteNames.DISSOLUTION_FIRM).catch(() => {})
this.$router.replace(RouteNames.DISSOLUTION_FIRM).catch(() => {})
} else {
this.$router.push(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
this.$router.replace(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
}
return
case FilingTypes.INCORPORATION_APPLICATION:
this.$router.push(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
this.$router.replace(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
return
case FilingTypes.REGISTRATION:
this.$router.push(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
this.$router.replace(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
return
case FilingTypes.RESTORATION:
this.$router.push(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
this.$router.replace(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
return
default:
this.invalidRouteDialog = true
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export default class Actions extends Mixins(AmalgamationMixin, CommonMixin,
this.setIsFilingPaying(false)
}
} else {
// don't call window.scrollTo during Vitest tests because jsdom doesn't implement it
// otherwise, smooth-scroll to the top of the page
window.scrollTo({ top: 0, behavior: 'smooth' })
}
}
Expand Down
1 change: 0 additions & 1 deletion src/components/common/SummaryDefineCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ export default class SummaryDefineCompany extends Vue {
/** Whether this section is invalid. */
get invalidSection (): boolean {
if (this.isAmalgamationFiling) {
// *** FUTURE: update this for short-form amalgamation (needs to be valid)
return (!this.isAmalgamationInformationValid || !this.isDefineCompanyValid)
}
return !this.isDefineCompanyValid
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function start () {
await KeycloakService.setKeycloakConfigUrl(keycloakConfig)

// initialize token service which will do a check-sso to initiate session
// don't start during Vitest tests as it messes up the test JWT
// only do when not in Vitest tests as it messes up the test JWT
if (import.meta.env.VITEST === undefined) {
console.info('Starting token refresh service...') // eslint-disable-line no-console
await KeycloakService.initializeToken()
Expand Down
5 changes: 0 additions & 5 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import { getName } from 'country-list'
*/
@Component({})
export default class CommonMixin extends Vue {
/** Is True if Vitest is running the code. */
get isVitestRunning (): boolean {
return (import.meta.env.VITEST !== undefined)
}

/**
* Compares two objects while omitting specified properties from the comparison.
* @param objA the first object to compare
Expand Down
5 changes: 4 additions & 1 deletion src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
}

// restore the Amalgamation Court Approval if it's True or False
if (draftFiling.amalgamationApplication.courtApproval !== null) {
if (
draftFiling.amalgamationApplication.courtApproval === true ||
draftFiling.amalgamationApplication.courtApproval === false
) {
this.setAmalgamationCourtApproval(draftFiling.amalgamationApplication.courtApproval)
}

Expand Down
4 changes: 2 additions & 2 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,11 @@ export const useStore = defineStore('store', {
this.getNameTranslationsValid
)
} else {
// NB - this is the only valid Correct Name Option for short-form amalgamations
// NB - there are no name translations for short-form amalgamations
return (
this.getAmalgamatingBusinessesValid &&
// NB - this is the only valid Correct Name Option for short-form amalgamations:
this.getCorrectNameOption === CorrectNameOptions.CORRECT_AML_ADOPT
// NB - there are no name translations for short-form amalgamations
)
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/views/Amalgamation/ReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ export default class AmalgamationReviewConfirm extends Vue {
/** Is true when the Folio Number is not valid */
get isFolioInvalid (): boolean {
return this.getValidateSteps && !(this.getFolioNumberValid)
return (this.getValidateSteps && !this.getFolioNumberValid)
}
/** Is true when the amalgamation statement is not valid */
get isAmalgamationStatementInvalid (): boolean {
return this.getValidateSteps && !(this.getAmalgamationCourtApprovalValid)
return (this.getValidateSteps && !this.getAmalgamationCourtApprovalValid)
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/AmalgamationInformation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const amalgamationRegularBusinessInfo = [
]

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

beforeAll(() => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/AmalgamationPeopleRoles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const amalgamationRegularBusinessInfo = [
]

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

beforeAll(() => {
Expand Down Expand Up @@ -52,7 +52,7 @@ for (const test of amalgamationRegularBusinessInfo) {

// *** TODO: finish the tests for short-form amalgamations
// especially differences between regular and short-form
describe(`Amalgamation Regular Business Information for a ${test.entityType}`, () => {
describe(`Amalgamation-Regular People and Roles for a ${test.entityType}`, () => {
let wrapper: any

beforeAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/AmalgamationReviewConfirm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const amalgamationRegularBusinessInfo = [
]

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

beforeAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/AmalgamationShareStructure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const amalgamationRegularBusinessInfo = [
]

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

beforeAll(() => {
Expand Down

0 comments on commit 5e1590d

Please sign in to comment.