@sprucelabs/data-stores 28.3.275 → 28.3.276

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.
@@ -341,19 +341,19 @@ const databaseAssertUtil = {
341
341
  const matchedBeforeDelete = yield db.findOne(this.collectionName, {
342
342
  id: created.id,
343
343
  });
344
- assert.isTruthy(matchedBeforeDelete);
345
- assert.isEqual(matchedBeforeDelete.id, created.id);
344
+ assert.isTruthy(matchedBeforeDelete, 'findOne() did not return the record created!');
345
+ assert.isEqual(matchedBeforeDelete.id, created.id, 'findOne() returned id does not match what was sent to createOne');
346
346
  const numDeleted = yield db.delete(this.collectionName, {
347
347
  id: matchedBeforeDelete.id,
348
348
  });
349
- assert.isEqual(numDeleted, 1);
349
+ assert.isEqual(numDeleted, 1, 'delete() did not return the total recrods deleted!');
350
350
  const matchedAfterDelete = yield db.findOne(this.collectionName, {
351
351
  id: created.id,
352
352
  });
353
- assert.isFalsy(matchedAfterDelete, `Record with the id of ${created.id} was not deleted!`);
353
+ assert.isFalsy(matchedAfterDelete, `Record with the id of ${created.id} was not deleted with delete()!`);
354
354
  yield db.create(this.collectionName, [
355
355
  {
356
- name: 'a record',
356
+ name: 'another record',
357
357
  },
358
358
  {
359
359
  name: 'a record',
@@ -362,8 +362,12 @@ const databaseAssertUtil = {
362
362
  name: 'a record',
363
363
  },
364
364
  ]);
365
- const manyDeleted = yield db.delete(this.collectionName, {});
366
- assert.isEqual(manyDeleted, 3, `delete() did not return the total recrods deleted!`);
365
+ const manyDeleted = yield db.delete(this.collectionName, {
366
+ name: 'another record',
367
+ });
368
+ assert.isEqual(manyDeleted, 1, `delete() did not return the total records deleted!`);
369
+ const total = yield db.count(this.collectionName);
370
+ assert.isEqual(total, 2, 'delete() did not delete all records');
367
371
  yield this.shutdown(db);
368
372
  });
369
373
  },
@@ -310,19 +310,19 @@ const databaseAssertUtil = {
310
310
  const matchedBeforeDelete = await db.findOne(this.collectionName, {
311
311
  id: created.id,
312
312
  });
313
- test_utils_1.assert.isTruthy(matchedBeforeDelete);
314
- test_utils_1.assert.isEqual(matchedBeforeDelete.id, created.id);
313
+ test_utils_1.assert.isTruthy(matchedBeforeDelete, 'findOne() did not return the record created!');
314
+ test_utils_1.assert.isEqual(matchedBeforeDelete.id, created.id, 'findOne() returned id does not match what was sent to createOne');
315
315
  const numDeleted = await db.delete(this.collectionName, {
316
316
  id: matchedBeforeDelete.id,
317
317
  });
318
- test_utils_1.assert.isEqual(numDeleted, 1);
318
+ test_utils_1.assert.isEqual(numDeleted, 1, 'delete() did not return the total recrods deleted!');
319
319
  const matchedAfterDelete = await db.findOne(this.collectionName, {
320
320
  id: created.id,
321
321
  });
322
- test_utils_1.assert.isFalsy(matchedAfterDelete, `Record with the id of ${created.id} was not deleted!`);
322
+ test_utils_1.assert.isFalsy(matchedAfterDelete, `Record with the id of ${created.id} was not deleted with delete()!`);
323
323
  await db.create(this.collectionName, [
324
324
  {
325
- name: 'a record',
325
+ name: 'another record',
326
326
  },
327
327
  {
328
328
  name: 'a record',
@@ -331,8 +331,12 @@ const databaseAssertUtil = {
331
331
  name: 'a record',
332
332
  },
333
333
  ]);
334
- const manyDeleted = await db.delete(this.collectionName, {});
335
- test_utils_1.assert.isEqual(manyDeleted, 3, `delete() did not return the total recrods deleted!`);
334
+ const manyDeleted = await db.delete(this.collectionName, {
335
+ name: 'another record',
336
+ });
337
+ test_utils_1.assert.isEqual(manyDeleted, 1, `delete() did not return the total records deleted!`);
338
+ const total = await db.count(this.collectionName);
339
+ test_utils_1.assert.isEqual(total, 2, 'delete() did not delete all records');
336
340
  await this.shutdown(db);
337
341
  },
338
342
  async assertCanLimitResultsToZero(connect) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "28.3.275",
6
+ "version": "28.3.276",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",