forked from Yara724/api
Use FileMaker and FileReviewer Fanavaran expert ids on V4/V5 flows.
Block file create and review when the matching third-party or car-body code is missing, and override GEN.03/GEN.06 ClaimExpertId from those profiles instead of tenant defaults. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
57
src/fanavaran/fanavaran-file-role-expert-ids.spec.ts
Normal file
57
src/fanavaran/fanavaran-file-role-expert-ids.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { BlameRequestType } from "src/Types&Enums/blame-request-management/blameRequestType.enum";
|
||||
import {
|
||||
assertFileMakerCanCreateBlameType,
|
||||
assertFileReviewerCanReviewBlameType,
|
||||
resolveFileMakerStageOneExpertId,
|
||||
resolveFileReviewerExpertiseExpertId,
|
||||
} from "./fanavaran-file-role-expert-ids";
|
||||
|
||||
describe("fanavaran-file-role-expert-ids", () => {
|
||||
it("resolves stage-1 and expertise ids by blame type", () => {
|
||||
expect(
|
||||
resolveFileMakerStageOneExpertId(
|
||||
{
|
||||
ThirdPartyClaimExpertId: "154",
|
||||
CarBodyClaimExpertId: "29",
|
||||
},
|
||||
BlameRequestType.THIRD_PARTY,
|
||||
),
|
||||
).toBe(154);
|
||||
expect(
|
||||
resolveFileMakerStageOneExpertId(
|
||||
{
|
||||
ThirdPartyClaimExpertId: "154",
|
||||
CarBodyClaimExpertId: "29",
|
||||
},
|
||||
BlameRequestType.CAR_BODY,
|
||||
),
|
||||
).toBe(29);
|
||||
expect(
|
||||
resolveFileReviewerExpertiseExpertId(
|
||||
{
|
||||
ThirdPartyExpertiseClaim: "2709",
|
||||
CarBodyExpertiseClaim: "15",
|
||||
},
|
||||
BlameRequestType.CAR_BODY,
|
||||
),
|
||||
).toBe(15);
|
||||
});
|
||||
|
||||
it("blocks file maker create when the product code is missing", () => {
|
||||
expect(() =>
|
||||
assertFileMakerCanCreateBlameType(
|
||||
{ ThirdPartyClaimExpertId: "154" },
|
||||
BlameRequestType.CAR_BODY,
|
||||
),
|
||||
).toThrow(/stage-1 claim expert id/);
|
||||
});
|
||||
|
||||
it("blocks file reviewer when the product code is missing", () => {
|
||||
expect(() =>
|
||||
assertFileReviewerCanReviewBlameType(
|
||||
{ CarBodyExpertiseClaim: "15" },
|
||||
BlameRequestType.THIRD_PARTY,
|
||||
),
|
||||
).toThrow(/expertise claim expert id/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user