forked from Yara724/api
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { ExpertInsurerService } from "./expert-insurer.service";
|
|
|
|
describe("insurer expert file summaries", () => {
|
|
const service = Object.create(
|
|
ExpertInsurerService.prototype,
|
|
) as ExpertInsurerService;
|
|
|
|
it("calculates blame review duration in minutes on the backend", () => {
|
|
const summary = (service as any).mapBlameFileSummaryForInsurerExpert({
|
|
_id: "6aa50ce70545fc1906433c85",
|
|
publicId: "RPT832-00049",
|
|
requestNo: "BL-RPT832-000049",
|
|
type: "THIRD_PARTY",
|
|
status: "WAITING_FOR_SIGNATURES",
|
|
blameStatus: "AGREED",
|
|
createdAt: new Date("2026-06-21T12:42:28.000Z"),
|
|
updatedAt: new Date("2026-06-21T15:32:28.000Z"),
|
|
});
|
|
|
|
expect(summary.reviewDurationMinutes).toBe(170);
|
|
});
|
|
|
|
it("calculates claim review duration with the same contract", () => {
|
|
const summary = (service as any).mapClaimFileSummaryForInsurerExpert({
|
|
_id: "6aa50ce70545fc1906433c86",
|
|
publicId: "RPT832-00049",
|
|
createdAt: "2026-06-21T12:42:28.000Z",
|
|
updatedAt: "2026-06-21T12:43:58.000Z",
|
|
});
|
|
|
|
expect(summary.reviewDurationMinutes).toBe(1.5);
|
|
});
|
|
|
|
it("returns null instead of NaN when a duration timestamp is unavailable", () => {
|
|
const summary = (service as any).mapBlameFileSummaryForInsurerExpert({
|
|
_id: "6aa50ce70545fc1906433c85",
|
|
createdAt: "invalid",
|
|
});
|
|
|
|
expect(summary.reviewDurationMinutes).toBeNull();
|
|
});
|
|
|
|
it("clamps malformed negative durations to zero", () => {
|
|
const summary = (service as any).mapClaimFileSummaryForInsurerExpert({
|
|
_id: "6aa50ce70545fc1906433c86",
|
|
createdAt: "2026-06-21T15:32:28.000Z",
|
|
updatedAt: "2026-06-21T12:42:28.000Z",
|
|
});
|
|
|
|
expect(summary.reviewDurationMinutes).toBe(0);
|
|
});
|
|
});
|