forked from Yara724/api
Require structured inquiry participant inputs
This commit is contained in:
@@ -66,22 +66,34 @@ describe("inquiry participant resolver", () => {
|
||||
).toBe(VehicleRegistrationState.CURRENT);
|
||||
});
|
||||
|
||||
it("keeps legacy driver/policyholder payloads working during rollout", () => {
|
||||
const resolved = resolveInquiryParticipants(BlameRequestType.THIRD_PARTY, {
|
||||
nationalCodeOfDriver: "0012345678",
|
||||
driverBirthday: "1370/01/01",
|
||||
driverLicense: "123456789",
|
||||
nationalCodeOfInsurer: "0098765432",
|
||||
insurerBirthday: "1360/02/02",
|
||||
driverIsInsurer: false,
|
||||
} as any);
|
||||
it("rejects the removed flat inquiry contract", () => {
|
||||
expect(() =>
|
||||
resolveInquiryParticipants(BlameRequestType.THIRD_PARTY, {
|
||||
nationalCodeOfDriver: "0012345678",
|
||||
driverBirthday: "1370/01/01",
|
||||
driverLicense: "123456789",
|
||||
nationalCodeOfInsurer: "0098765432",
|
||||
insurerBirthday: "1360/02/02",
|
||||
driverIsInsurer: false,
|
||||
} as any),
|
||||
).toThrow(BadRequestException);
|
||||
});
|
||||
|
||||
expect(resolved.legacy).toBe(true);
|
||||
expect(resolved.roles.driver).toBe("DRIVER");
|
||||
expect(resolved.roles.thirdPartyPolicyholder).toBe(
|
||||
"THIRD_PARTY_POLICYHOLDER",
|
||||
);
|
||||
expect(resolved.roles.vehicleOwner).toBeUndefined();
|
||||
it("rejects phone numbers in participant inquiry identity", () => {
|
||||
expect(() =>
|
||||
resolveInquiryParticipants(BlameRequestType.THIRD_PARTY, {
|
||||
driver: {
|
||||
nationalCode: "0012345678",
|
||||
birthday: "1370/01/01",
|
||||
hasDrivingLicense: false,
|
||||
phoneNumber: "09120000000",
|
||||
},
|
||||
vehicleOwner: { sameAs: InquiryParticipantRole.DRIVER },
|
||||
thirdPartyPolicyholder: {
|
||||
sameAs: InquiryParticipantRole.DRIVER,
|
||||
},
|
||||
} as any),
|
||||
).toThrow(BadRequestException);
|
||||
});
|
||||
|
||||
it("keeps third-party and car-body policyholders distinct", () => {
|
||||
@@ -116,11 +128,13 @@ describe("inquiry participant resolver", () => {
|
||||
|
||||
it("projects role-complete input onto the existing inquiry fields", () => {
|
||||
const normalized = normalizeInquirySubmission(BlameRequestType.CAR_BODY, {
|
||||
plate: {
|
||||
leftDigits: "44",
|
||||
centerAlphabet: "ب",
|
||||
centerDigits: "111",
|
||||
ir: "22",
|
||||
vehicle: {
|
||||
currentPlate: {
|
||||
leftDigits: "44",
|
||||
centerAlphabet: "ب",
|
||||
centerDigits: "111",
|
||||
ir: "22",
|
||||
},
|
||||
},
|
||||
driver: {
|
||||
nationalCode: "0012345678",
|
||||
|
||||
Reference in New Issue
Block a user