Removed some validations that were unneccesary for expert submit

This commit is contained in:
SepehrYahyaee
2026-09-06 12:09:34 +03:30
parent 233a16d96c
commit c9b5b6f765
5 changed files with 74 additions and 43 deletions

View File

@@ -26,7 +26,7 @@ describe("SubmitExpertReplyV2Dto", () => {
expect(errors).not.toHaveLength(0);
});
it("accepts a replacement part without a price", async () => {
it("rejects a replacement part without a price", async () => {
const dto = plainToInstance(SubmitExpertReplyV2Dto, {
description: "Damage assessment",
parts: [
@@ -41,7 +41,7 @@ describe("SubmitExpertReplyV2Dto", () => {
],
});
expect(await validate(dto)).toHaveLength(0);
expect(await validate(dto)).not.toHaveLength(0);
});
it("accepts a repair part without daghi", async () => {
@@ -61,4 +61,33 @@ describe("SubmitExpertReplyV2Dto", () => {
expect(await validate(dto)).toHaveLength(0);
});
it("accepts the expert's repair and replacement pricing rules", async () => {
const dto = plainToInstance(SubmitExpertReplyV2Dto, {
description: "Damage assessment",
parts: [
{
partId: 11,
typeOfDamage: TypeOfDamage.Repair,
salary: "۵,۰۰۰",
totalPayment: "5000",
factorNeeded: false,
},
{
partId: 23,
typeOfDamage: TypeOfDamage.Change,
price: "۵۰,۰۰۰",
salary: "۱۰۰,۰۰۰",
totalPayment: "150000",
factorNeeded: false,
daghi: {
option: DaghiOption.RECYCLED_PARTS_VALUE,
price: "۱۰۰,۵۰۰,۰۰۰",
},
},
],
});
expect(await validate(dto)).toHaveLength(0);
});
});