Added some new tests

This commit is contained in:
Damien Broqua 2020-02-13 22:36:14 +01:00
parent 0039a8b4ec
commit 918f873fea
15 changed files with 887 additions and 114 deletions

View file

@ -12,10 +12,9 @@ const Rules = {
{
collection: "Brand",
requiredRole: ["admin", "user"]
// },
// {
// collection: "Colors",
// requiredRole: ["admin", "user"]
},
{
collection: "Colors"
}
],
format: {
@ -31,6 +30,7 @@ const Rules = {
validate: {
create: Joi.object({
name: Joi.string().required(),
colorsId: Joi.array().items(Joi.number().integer()),
active: Joi.boolean(),
year: Joi.number()
.integer()
@ -38,7 +38,9 @@ const Rules = {
brandId: Joi.number().integer()
}),
update: Joi.object({
name: Joi.string()
name: Joi.string(),
year: Joi.number().integer(),
colorsId: Joi.array().items(Joi.number().integer())
}),
item: Joi.object({
carId: Joi.number().required()
@ -119,6 +121,9 @@ const Rules = {
}
}
}
},
belongsToMany: {
colorsId: "Colors"
}
};