I am asking you for help. I have created a DTO that looks like it (this is a smaller version) :
export class OfImportDto {
@IsString({
message: "should be a valid product code"
})
productCode: string;
@IsString({
message: "Enter the proper product description"
})
productDescription: string;
@IsDateString({
message: "should be a valid date format, for example : 2017-06-07T14:34:08+04:00"
})
manufacturingDate : Date
@IsInt({
message: "should be a valid planned quantity number"
})
@IsPositive()
plannedQuantity: number;
the thing is that i am asking to test that, with a unit test and not a E2E test. And I Don't know how to do that. For instance, I would like to unit test 1/ if my product code is well a string, a string should be created, if not, throw my exception 2/ if my product description is well a string, a string should be created, if not, throw my exception ... and so on.
So, can I made a spec.ts file to test that? If yes, how? If not, is it better to test it within the service.spec.ts? If so, how?
Thank you very much, any help would be very helpful :)