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

mes-9760-searchCompletedWordingUpdate #1731

Merged
merged 1 commit into from
Sep 23, 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
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';
}
}
Loading