forked from Yara724/api
Complete inquiry participant flow coverage
This commit is contained in:
@@ -421,6 +421,41 @@ describe("inquiry participant resolver", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("does not use the previous plate after a transport or provider outage", async () => {
|
||||
const currentPlate = {
|
||||
leftDigits: "44",
|
||||
centerAlphabet: "ب",
|
||||
centerDigits: "111",
|
||||
ir: "22",
|
||||
};
|
||||
const query = jest.fn().mockRejectedValue(
|
||||
Object.assign(new Error("upstream timeout"), {
|
||||
code: "ETIMEDOUT",
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(
|
||||
runPlateInquiryWithFallback({
|
||||
vehicle: resolveInquiryVehicle({
|
||||
registrationState: VehicleRegistrationState.RECENTLY_TRANSFERRED,
|
||||
currentPlate,
|
||||
previousPlate: {
|
||||
leftDigits: "55",
|
||||
centerAlphabet: "ج",
|
||||
centerDigits: "222",
|
||||
ir: "33",
|
||||
},
|
||||
vin: "NAAM01E15HK123456",
|
||||
}),
|
||||
fallbackCurrentPlate: currentPlate,
|
||||
query,
|
||||
isUsable: () => false,
|
||||
mappedValue: () => ({}),
|
||||
}),
|
||||
).rejects.toThrow("upstream timeout");
|
||||
expect(query).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("allows an explicitly unknown policyholder only for a damaged-party submission", () => {
|
||||
const input = {
|
||||
driver: {
|
||||
|
||||
Reference in New Issue
Block a user