prisma-mock 0.0.31 → 0.0.32

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.
Files changed (2) hide show
  1. package/lib/index.js +14 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -179,7 +179,20 @@ const createPrismaMock = async (data = {}, pathToSchema, client = (0, jest_mock_
179
179
  }
180
180
  }
181
181
  if (c.disconnect) {
182
- d = Object.assign(Object.assign({}, d), { [field.relationFromFields[0]]: null });
182
+ if (field.relationFromFields.length > 0) {
183
+ d = Object.assign(Object.assign({}, d), { [field.relationFromFields[0]]: null });
184
+ }
185
+ else {
186
+ const joinfield = getJoinField(field);
187
+ delegate.update({
188
+ data: {
189
+ [joinfield.relationFromFields[0]]: null
190
+ },
191
+ where: {
192
+ [joinfield.relationFromFields[0]]: item[joinfield.relationToFields[0]]
193
+ }
194
+ });
195
+ }
183
196
  }
184
197
  const _e = d, _f = field.name, _update = _e[_f], rest = __rest(_e, [typeof _f === "symbol" ? _f : _f + ""]);
185
198
  d = rest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-mock",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Mock prisma for unit testing database",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",