forked from Yara724/api
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>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
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/);
|
|
});
|
|
});
|