Skip to content

Commit

Permalink
Improve resilience when potential missing props, fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-HMCTS committed Nov 6, 2024
1 parent 0c140fe commit 718ab59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export abstract class AbstractFieldWriteJourneyComponent extends AbstractFieldWr

protected previousPage(): void {
if (this.hasPrevious()) {
if (!this.childJourney['searchLanguageInterpreterHint']){
if (!this.childJourney?.searchLanguageInterpreterHint){
this.journeyPageNumber--;
}
this.onPageChange();
Expand All @@ -52,7 +52,7 @@ export abstract class AbstractFieldWriteJourneyComponent extends AbstractFieldWr

protected nextPage(): void {
if (this.hasNext()) {
if (!this.childJourney['searchLanguageInterpreterHint']){
if (!this.childJourney?.searchLanguageInterpreterHint){
this.journeyPageNumber++;
}
this.onPageChange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export class SelectFlagTypeComponent extends AbstractJourneyComponent implements
} else {
// this code will run only when the sub journey is complete
const currentSelectedFlag = this.formGroup.controls.flagType;
const addedFlagValue = this.selectedFlagsLocation['caseField'].value.details;
if (addedFlagValue[Object.keys(addedFlagValue).length]?.name !== currentSelectedFlag.value.name) {
const addedFlagValue = this.selectedFlagsLocation?.caseField?.value?.details;
if (addedFlagValue && (addedFlagValue[Object.keys(addedFlagValue).length]?.name !== currentSelectedFlag.value.name)) {
this.selectedFlagsLocation['caseField'].value.details.pop();
this.selectedFlagsLocation['caseField'].formatted_value?.details.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface Journey {
childJourney: Journey;
fieldState?: number;
linkedCasesPage?: number;
searchLanguageInterpreterHint?;
}

0 comments on commit 718ab59

Please sign in to comment.