prisma-mock 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +7 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -409,8 +409,13 @@ const createPrismaMock = async (data = {}, pathToSchema, client = (0, jest_mock_
|
|
|
409
409
|
const d = nestedUpdate(args, true, null);
|
|
410
410
|
data = Object.assign(Object.assign({}, data), { [prop]: [...data[prop], d] });
|
|
411
411
|
data = removeMultiFieldIds(model, data);
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
let where = {};
|
|
413
|
+
for (const field of model.fields) {
|
|
414
|
+
if (field.default) {
|
|
415
|
+
where[field.name] = d[field.name];
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return findOne(Object.assign({ where }, args));
|
|
414
419
|
};
|
|
415
420
|
const deleteMany = args => {
|
|
416
421
|
const model = cachedSchema.datamodel.models.find(model => {
|