Skip to content

Commit

Permalink
reworded no mot status on view-test-result
Browse files Browse the repository at this point in the history
  • Loading branch information
RLCorp committed Sep 20, 2024
1 parent e416624 commit 364f68a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -546,5 +546,24 @@ describe('VehicleDetailsCardComponent', () => {
expect(component.isInvalidMOT()).toEqual(false);
});
});

describe('getNoMOTDataText', () => {
it('returns the correct text when registration number is available', () => {
spyOnProperty(component, 'registrationNumber').and.returnValue('ABC123');
expect(component.getNoMOTDataText()).toEqual('Unable to determine MOT status for ABC123');
});

it('returns the correct text when there are previously filtered VRNs but no registration number', () => {
spyOnProperty(component, 'registrationNumber').and.returnValue(null);
spyOn(component, 'getPreviousFilteredVRNs').and.returnValue(['XYZ789']);
expect(component.getNoMOTDataText()).toEqual('Unable to determine MOT status');
});

it('returns the correct text when there are no previously filtered VRNs and no registration number', () => {
spyOnProperty(component, 'registrationNumber').and.returnValue(null);
spyOn(component, 'getPreviousFilteredVRNs').and.returnValue([]);
expect(component.getNoMOTDataText()).toEqual('No VRNs were checked for MOT');
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h2 class="des-header-style-4" id="view-test-result-vehicle-details-title">Vehic

<data-row-custom [centredData]="true" [label]="'MOT Status'">
<div class="ion-no-padding" *ngIf="!(data?.motStatus)">
<ion-text class="mes-data">No VRNs were checked for MOT</ion-text>
<ion-text class="mes-data">{{getNoMOTDataText()}}</ion-text>
</div>
<div class="display-flex ion-no-padding width-100-percent" *ngIf="data?.motStatus">
<ion-col class="ion-align-items-center display-flex" size="10" *ngIf="isInvalidMOT()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,21 @@ export class VehicleDetailsCardComponent {
}
return this.data?.testExpiryDate ? 'Expired ' + this.data?.testExpiryDate : 'Not valid';
}

/**
* Get the text indicating the absence of MOT data.
*
* @returns {string} - The text indicating the absence of MOT data. Possible values are:
* - 'Unable to determine MOT status for {registrationNumber}' if a registration number is available.
* - 'Unable to determine MOT status' if there are previously filtered VRNs but no registration number.
* - 'No VRNs were checked for MOT' if there are no previously filtered VRNs and no registration number.
*/
getNoMOTDataText(): string {
if (this.registrationNumber) {
return 'Unable to determine MOT status for ' + this.registrationNumber;
} else if (this.getPreviousFilteredVRNs().length > 0) {
return 'Unable to determine MOT status';
}
return 'No VRNs were checked for MOT';
}
}

0 comments on commit 364f68a

Please sign in to comment.