fix(workflows): resolve QA blockers and protect case evidence

Fix registrar signing, reviewer re-entry, replacement evidence freshness, owner decision and rating races, multipart objections, vehicle serialization and product reporting.

Validate uploaded media with FFmpeg, serve evidence through expiring signed links, and add targeted regressions plus a dry-run repair for prematurely completed visit cases.
This commit is contained in:
SepehrYahyaee
2026-11-22 12:50:22 +03:30
parent abc40df199
commit 6b968c0952
37 changed files with 1118 additions and 211 deletions
@@ -0,0 +1,61 @@
import { ExpertInsurerService } from "./expert-insurer.service";
import { Types } from "mongoose";
describe("QA reporting regressions", () => {
it("classifies a roster-owned claim by its linked blame even when that blame is outside the party-insurer list", async () => {
const s: any = Object.create(ExpertInsurerService.prototype);
const clientKey = String(new Types.ObjectId()),
expertId = new Types.ObjectId(),
blameId = new Types.ObjectId();
s.expertDbService = { findAll: jest.fn().mockResolvedValue([]) };
s.damageExpertDbService = {
findAll: jest
.fn()
.mockResolvedValue([
{ _id: expertId, firstName: "QA", lastName: "Expert" },
]),
};
s.fieldExpertDbService = { findAll: jest.fn().mockResolvedValue([]) };
s.getClientBlameFiles = jest.fn().mockResolvedValue([]);
s.getClientClaimFiles = jest
.fn()
.mockResolvedValue([
{
_id: new Types.ObjectId(),
blameRequestId: blameId,
createdAt: new Date(),
},
]);
s.expertFileActivityDbService = {
findByTenant: jest.fn().mockResolvedValue([]),
};
s.claimDamageExpertActorId = jest.fn().mockReturnValue(String(expertId));
s.blameRequestDbService = {
find: jest.fn().mockResolvedValue([{ _id: blameId, type: "CAR_BODY" }]),
};
const result = await s.buildExpertReportRows({ clientKey });
expect(result.experts[0]).toMatchObject({
totalFiles: 1,
carBodyFiles: 1,
thirdPartyFiles: 0,
});
expect(s.blameRequestDbService.find).toHaveBeenCalledWith(
{ _id: { $in: [blameId] } },
{ lean: true, select: "type" },
);
});
it("preserves current root user ratings and falls back to legacy nested ratings", () => {
const s: any = Object.create(ExpertInsurerService.prototype);
const current = { overallEvaluation: 5 },
legacy = { overallEvaluation: 1 };
expect(
s.normalizeClaimCase({
userRating: current,
evaluation: { userRating: legacy },
}).userRating,
).toBe(current);
expect(
s.normalizeClaimCase({ evaluation: { userRating: legacy } }).userRating,
).toBe(legacy);
});
});