forked from Yara724/api
Accept and persist address-only locations across user and expert flows, preserve workflow authorization, and include addresses in reports and Fanavaran review. Expose persisted final submission completion so the expert panel can prevent repeat sends.
103 lines
2.9 KiB
TypeScript
103 lines
2.9 KiB
TypeScript
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
|
import { fanavaranClaimReferences } from "./fanavaran-claim-references";
|
|
|
|
describe("fanavaranClaimReferences", () => {
|
|
it("returns all four Fanavaran ids when the claim is completed", () => {
|
|
expect(
|
|
fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.COMPLETED,
|
|
claimId: 987654,
|
|
claimNo: 123456,
|
|
dmgCaseId: 11,
|
|
expertiseId: 22,
|
|
}),
|
|
).toEqual({
|
|
submissionCompleted: true,
|
|
claimId: 987654,
|
|
claimNo: 123456,
|
|
dmgCaseId: 11,
|
|
expertiseId: 22,
|
|
});
|
|
});
|
|
|
|
it("exposes the persisted Fanavaran reference codes to expert detail APIs", () => {
|
|
expect(
|
|
fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.COMPLETED,
|
|
claimId: 100,
|
|
claimNo: 101,
|
|
dmgCaseId: 102,
|
|
expertiseId: 103,
|
|
fanavaranSync: {
|
|
baseClaim: { policyId: 104 },
|
|
damageCase: {
|
|
driverId: 105,
|
|
vehicleKindId: 106,
|
|
plaqueKindId: 107,
|
|
plaqueSampleId: 108,
|
|
accidentVehicleUsedId: 109,
|
|
insuranceCorpId: 110,
|
|
},
|
|
},
|
|
}),
|
|
).toEqual({
|
|
submissionCompleted: true,
|
|
claimId: 100,
|
|
claimNo: 101,
|
|
dmgCaseId: 102,
|
|
expertiseId: 103,
|
|
policyId: 104,
|
|
driverId: 105,
|
|
vehicleKindId: 106,
|
|
plaqueKindId: 107,
|
|
plaqueSampleId: 108,
|
|
accidentVehicleUsedId: 109,
|
|
insuranceCorpId: 110,
|
|
});
|
|
});
|
|
|
|
it("omits missing ids", () => {
|
|
expect(
|
|
fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.COMPLETED,
|
|
claimId: 987654,
|
|
claimNo: null,
|
|
dmgCaseId: undefined,
|
|
expertiseId: 22,
|
|
}),
|
|
).toEqual({
|
|
submissionCompleted: true,
|
|
claimId: 987654,
|
|
expertiseId: 22,
|
|
});
|
|
});
|
|
|
|
it("keeps partial stage codes retryable", () => {
|
|
expect(fanavaranClaimReferences({ status: ClaimCaseStatus.COMPLETED, claimId: 1, dmgCaseId: 2 }))
|
|
.not.toHaveProperty("submissionCompleted");
|
|
});
|
|
|
|
it("exposes final acceptance independently of local workflow status", () => {
|
|
expect(fanavaranClaimReferences({ status: ClaimCaseStatus.EXPERT_REVIEWING, expertiseId: 22 }))
|
|
.toEqual({ submissionCompleted: true });
|
|
expect(fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.COMPLETED,
|
|
fanavaranSync: { expertise: { status: "success" } },
|
|
})).toEqual({ submissionCompleted: true });
|
|
expect(fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.COMPLETED,
|
|
fanavaranSync: { expertise: { status: "failed" } },
|
|
})).toBeUndefined();
|
|
});
|
|
|
|
it("returns undefined before the claim is completed", () => {
|
|
expect(
|
|
fanavaranClaimReferences({
|
|
status: ClaimCaseStatus.EXPERT_REVIEWING,
|
|
claimId: 987654,
|
|
dmgCaseId: 11,
|
|
}),
|
|
).toBeUndefined();
|
|
});
|
|
});
|