forked from Yara724/api
fix: make user branch selection and signature completion reliable
This commit is contained in:
@@ -249,4 +249,20 @@ describe("user blame next action and claim eligibility", () => {
|
||||
expect(response.parties[0].role).toBe("SECOND");
|
||||
expect(JSON.stringify(response)).not.toContain("09120000001");
|
||||
});
|
||||
it("repairs interrupted signatures in the case list before calculating the next page", async () => {
|
||||
const service = subject();
|
||||
const record = blame({status:"WAITING_FOR_SIGNATURES",workflow:{currentStep:"WAITING_FOR_SIGNATURES"}});
|
||||
service.blameRequestDbService = {
|
||||
find: jest.fn().mockResolvedValue([record]),
|
||||
findOneAndUpdate: jest.fn(async (filter,update) => {
|
||||
expect(filter.status).toBe("WAITING_FOR_SIGNATURES");
|
||||
expect(filter.$and).toHaveLength(2);
|
||||
return {...record,status:update.$set.status,workflow:{currentStep:"COMPLETED"}};
|
||||
}),
|
||||
};
|
||||
const response = await service.getAllBlameRequestsV2({sub:damagedId,role:RoleEnum.USER});
|
||||
expect(response.list[0]).toMatchObject({status:"COMPLETED",nextAction:"CREATE_CLAIM"});
|
||||
expect(service.blameRequestDbService.findOneAndUpdate).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user