forked from Yara724/api
fix: harden claim review and inquiry workflows
Preserve damage history and current vehicle price, restore depreciation mapping, normalize inquiry/report output, and support resumable expert review with paginated case retrieval.
This commit is contained in:
@@ -14,6 +14,7 @@ describe("RequestManagementService FileReviewer inbox", () => {
|
||||
publicId: "BLM-OPEN",
|
||||
type: "THIRD_PARTY",
|
||||
status: "WAITING_FOR_FILE_REVIEWER",
|
||||
createdAt: new Date("2026-01-02T00:00:00.000Z"),
|
||||
isMadeByFileMaker: true,
|
||||
expertInitiated: true,
|
||||
creationMethod: "IN_PERSON",
|
||||
@@ -34,6 +35,9 @@ describe("RequestManagementService FileReviewer inbox", () => {
|
||||
undefined,
|
||||
blameRequestDbService,
|
||||
) as RequestManagementService;
|
||||
(service as any).claimCaseDbService = {
|
||||
find: jest.fn().mockResolvedValue([]),
|
||||
};
|
||||
return { service, blameRequestDbService };
|
||||
}
|
||||
|
||||
@@ -46,7 +50,7 @@ describe("RequestManagementService FileReviewer inbox", () => {
|
||||
clientKey: String(clientId),
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
expect(result.list).toEqual([
|
||||
expect.objectContaining({ _id: sealedFile._id, publicId: "BLM-OPEN" }),
|
||||
]);
|
||||
expect(blameRequestDbService.find).toHaveBeenCalledWith(
|
||||
@@ -82,7 +86,34 @@ describe("RequestManagementService FileReviewer inbox", () => {
|
||||
clientKey: String(clientId),
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result.list).toEqual([]);
|
||||
});
|
||||
|
||||
it("sorts and paginates the reviewer inbox with the shared list contract", async () => {
|
||||
const olderFile = {
|
||||
...sealedFile,
|
||||
_id: new Types.ObjectId(),
|
||||
publicId: "BLM-OLDER",
|
||||
createdAt: new Date("2026-01-01T00:00:00.000Z"),
|
||||
};
|
||||
const { service } = createService([olderFile, sealedFile]);
|
||||
|
||||
const result = await service.getMyFileReviewerFiles(
|
||||
{
|
||||
sub: String(reviewerId),
|
||||
role: RoleEnum.FILE_REVIEWER,
|
||||
clientKey: String(clientId),
|
||||
},
|
||||
{ page: 1, limit: 1, sortBy: "createdAt", sortOrder: "desc" },
|
||||
);
|
||||
|
||||
expect(result).toEqual(
|
||||
expect.objectContaining({ total: 2, page: 1, limit: 1, totalPages: 2 }),
|
||||
);
|
||||
expect(result.list).toHaveLength(1);
|
||||
expect(result.list[0]).toEqual(
|
||||
expect.objectContaining({ publicId: "BLM-OPEN" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("does not expose an open file's details to a reviewer from another tenant", async () => {
|
||||
|
||||
Reference in New Issue
Block a user