forked from Yara724/api
Added complete validation for expert claim submit state
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { plainToInstance } from "class-transformer";
|
||||
import { validate } from "class-validator";
|
||||
import { DaghiOption } from "src/Types&Enums/claim-request-management/daghi-option.enum";
|
||||
import { TypeOfDamage } from "src/Types&Enums/claim-request-management/type-of-damage.enum";
|
||||
import { SubmitExpertReplyV2Dto } from "./expert-claim-v2.dto";
|
||||
|
||||
describe("SubmitExpertReplyV2Dto", () => {
|
||||
@@ -10,7 +11,7 @@ describe("SubmitExpertReplyV2Dto", () => {
|
||||
parts: [
|
||||
{
|
||||
partId: 201,
|
||||
typeOfDamage: "Minor",
|
||||
typeOfDamage: TypeOfDamage.Repair,
|
||||
price: "",
|
||||
salary: "",
|
||||
totalPayment: "",
|
||||
@@ -24,4 +25,22 @@ describe("SubmitExpertReplyV2Dto", () => {
|
||||
|
||||
expect(errors).not.toHaveLength(0);
|
||||
});
|
||||
|
||||
it("accepts a replacement part without a price", async () => {
|
||||
const dto = plainToInstance(SubmitExpertReplyV2Dto, {
|
||||
description: "Damage assessment",
|
||||
parts: [
|
||||
{
|
||||
partId: 201,
|
||||
typeOfDamage: TypeOfDamage.Change,
|
||||
salary: "0",
|
||||
totalPayment: "0",
|
||||
factorNeeded: false,
|
||||
daghi: { option: DaghiOption.NO_VALUE },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(await validate(dto)).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user