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
+23 -5
View File
@@ -47,7 +47,7 @@ describe("getExpertReplyPricingValidationError", () => {
).toBeNull();
});
it("rejects a repair line without a price", () => {
it("accepts a repair line without a price", () => {
expect(
getExpertReplyPricingValidationError([
{
@@ -55,10 +55,9 @@ describe("getExpertReplyPricingValidationError", () => {
typeOfDamage: TypeOfDamage.Repair,
salary: "0",
totalPayment: "0",
daghi: { option: DaghiOption.NO_VALUE },
},
]),
).toMatch(/price is also required/);
).toBeNull();
});
it("rejects recycled-value daghi without its price", () => {
@@ -67,6 +66,7 @@ describe("getExpertReplyPricingValidationError", () => {
{
partId: 201,
typeOfDamage: TypeOfDamage.Change,
price: "0",
salary: "0",
totalPayment: "0",
daghi: { option: DaghiOption.RECYCLED_PARTS_VALUE },
@@ -75,7 +75,7 @@ describe("getExpertReplyPricingValidationError", () => {
).toMatch(/requires a valid daghi price/);
});
it("accepts a replacement line without a part price", () => {
it("rejects a replacement line without a part price", () => {
expect(
getExpertReplyPricingValidationError([
{
@@ -86,7 +86,7 @@ describe("getExpertReplyPricingValidationError", () => {
daghi: { option: DaghiOption.NO_VALUE },
},
]),
).toBeNull();
).toMatch(/price is also required/);
});
it("rejects an invalid price when a replacement line supplies one", () => {
@@ -103,4 +103,22 @@ describe("getExpertReplyPricingValidationError", () => {
]),
).toMatch(/requires valid salary and totalPayment/);
});
it("accepts a recycled-parts daghi price above the repair-line cap", () => {
expect(
getExpertReplyPricingValidationError([
{
partId: 23,
typeOfDamage: TypeOfDamage.Change,
price: "۵۰,۰۰۰",
salary: "۱۰۰,۰۰۰",
totalPayment: "150000",
daghi: {
option: DaghiOption.RECYCLED_PARTS_VALUE,
price: "۱۰۰,۵۰۰,۰۰۰",
},
},
]),
).toBeNull();
});
});