forked from Yara724/api
feat: complete in-person claims without final sign
This commit is contained in:
56
src/request-management/file-maker-claim-approval-v5.spec.ts
Normal file
56
src/request-management/file-maker-claim-approval-v5.spec.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Types } from "mongoose";
|
||||
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
import { RequestManagementService } from "./request-management.service";
|
||||
|
||||
describe("RequestManagementService V5 FileMaker approval", () => {
|
||||
it("completes the claim without notifying the owner for a final signature", async () => {
|
||||
const fileMakerId = new Types.ObjectId();
|
||||
const claimId = new Types.ObjectId();
|
||||
const claimCaseDbService = {
|
||||
findById: jest.fn().mockResolvedValue({
|
||||
_id: claimId,
|
||||
publicId: "CLM-V5",
|
||||
status: ClaimCaseStatus.WAITING_FOR_FILE_MAKER_APPROVAL,
|
||||
requiresFileMakerApproval: true,
|
||||
fileMakerApprovalActorId: fileMakerId,
|
||||
}),
|
||||
findByIdAndUpdate: jest.fn().mockResolvedValue({}),
|
||||
};
|
||||
const service = new (RequestManagementService as any)(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
claimCaseDbService,
|
||||
) as RequestManagementService;
|
||||
|
||||
const result = await service.fileMakerApproveV5(
|
||||
{ sub: String(fileMakerId), role: RoleEnum.FILE_MAKER },
|
||||
String(claimId),
|
||||
);
|
||||
|
||||
expect(result.status).toBe(ClaimCaseStatus.COMPLETED);
|
||||
expect(result.message).toContain("Submit it to Fanavaran manually");
|
||||
expect(claimCaseDbService.findByIdAndUpdate).toHaveBeenCalledWith(
|
||||
String(claimId),
|
||||
expect.objectContaining({
|
||||
$set: expect.objectContaining({
|
||||
status: ClaimCaseStatus.COMPLETED,
|
||||
requiresFileMakerApproval: false,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user