@sprucelabs/data-stores 28.3.270 → 28.3.272
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.
@@ -603,7 +603,7 @@ const databaseAssertUtil = {
|
|
603
603
|
assert.isEqual(updated.name, 'updated', 'updateOne() did not update the fields. I tried to update the name field to "updated".');
|
604
604
|
assert.isEqual(updated.isPublic, true, 'Make sure you return existing fields from updateOne()! So, the actual record.');
|
605
605
|
const match = yield db.findOne(this.collectionName, { id: updated.id });
|
606
|
-
assert.isEqualDeep(match, updated, 'The record in the database did not actually
|
606
|
+
assert.isEqualDeep(match, Object.assign(Object.assign({}, inserted), { name: 'updated' }), 'The record in the database did not actually updated! Check that fields are not lost as well as updated.');
|
607
607
|
yield this.shutdown(db);
|
608
608
|
});
|
609
609
|
},
|
@@ -1408,9 +1408,9 @@ const databaseAssertUtil = {
|
|
1408
1408
|
undefinedField: undefined,
|
1409
1409
|
name: generateId(),
|
1410
1410
|
});
|
1411
|
-
assert.isTruthy(createdUndefined);
|
1411
|
+
assert.isTruthy(createdUndefined, 'upsertOne() should have returned a record.');
|
1412
1412
|
assert.isTrue(createdUndefined.undefinedField === null ||
|
1413
|
-
createdUndefined.undefinedfield === null);
|
1413
|
+
createdUndefined.undefinedfield === null, 'upsertOne() should make undefined values as null.');
|
1414
1414
|
const createdNull = yield db.upsertOne(this.collectionName, {
|
1415
1415
|
nullField: null,
|
1416
1416
|
name: '234',
|
@@ -1418,21 +1418,21 @@ const databaseAssertUtil = {
|
|
1418
1418
|
nullField: null,
|
1419
1419
|
name: generateId(),
|
1420
1420
|
});
|
1421
|
-
assert.isTruthy(createdNull);
|
1421
|
+
assert.isTruthy(createdNull, 'upsertOne() should have returned a record.');
|
1422
1422
|
let all = yield db.find(this.collectionName);
|
1423
1423
|
assert.isLength(all, 2, 'I expected to find 2 records after 2 upserts.');
|
1424
1424
|
const updatedUndefined = yield db.upsertOne(this.collectionName, {
|
1425
1425
|
undefinedField: undefined,
|
1426
1426
|
}, { undefinedField: 'now defined' });
|
1427
|
-
assert.isEqual(updatedUndefined.id, createdUndefined.id);
|
1428
|
-
assert.isEqual((_a = updatedUndefined.undefinedField) !== null && _a !== void 0 ? _a : updatedUndefined.undefinedfield, 'now defined');
|
1427
|
+
assert.isEqual(updatedUndefined.id, createdUndefined.id, 'upsertOne() should have returned the same record.');
|
1428
|
+
assert.isEqual((_a = updatedUndefined.undefinedField) !== null && _a !== void 0 ? _a : updatedUndefined.undefinedfield, 'now defined', 'upsertOne() should have made the updates i asked for.');
|
1429
1429
|
const updatedNull = yield db.upsertOne(this.collectionName, {
|
1430
1430
|
nullField: null,
|
1431
1431
|
}, { nullField: 'now defined' });
|
1432
|
-
assert.isEqual(updatedNull.id, createdNull.id);
|
1433
|
-
assert.isEqual((_b = updatedNull.nullField) !== null && _b !== void 0 ? _b : updatedNull.nullfield, 'now defined', '
|
1432
|
+
assert.isEqual(updatedNull.id, createdNull.id, "upsertOne() should have returned the same record. I'm querying based on a null value.");
|
1433
|
+
assert.isEqual((_b = updatedNull.nullField) !== null && _b !== void 0 ? _b : updatedNull.nullfield, 'now defined', 'upsertOne() should have made the updates i asked for.');
|
1434
1434
|
all = yield db.find(this.collectionName);
|
1435
|
-
assert.isLength(all, 2);
|
1435
|
+
assert.isLength(all, 2, 'I expected to find 2 records after 2 upserts. Make sure queries are honoring null values.');
|
1436
1436
|
yield this.shutdown(db);
|
1437
1437
|
});
|
1438
1438
|
},
|
@@ -548,7 +548,7 @@ const databaseAssertUtil = {
|
|
548
548
|
test_utils_1.assert.isEqual(updated.name, 'updated', 'updateOne() did not update the fields. I tried to update the name field to "updated".');
|
549
549
|
test_utils_1.assert.isEqual(updated.isPublic, true, 'Make sure you return existing fields from updateOne()! So, the actual record.');
|
550
550
|
const match = await db.findOne(this.collectionName, { id: updated.id });
|
551
|
-
test_utils_1.assert.isEqualDeep(match, updated, 'The record in the database did not actually
|
551
|
+
test_utils_1.assert.isEqualDeep(match, Object.assign(Object.assign({}, inserted), { name: 'updated' }), 'The record in the database did not actually updated! Check that fields are not lost as well as updated.');
|
552
552
|
await this.shutdown(db);
|
553
553
|
},
|
554
554
|
async assertCanSortById(connect) {
|
@@ -1289,9 +1289,9 @@ const databaseAssertUtil = {
|
|
1289
1289
|
undefinedField: undefined,
|
1290
1290
|
name: (0, generateId_1.default)(),
|
1291
1291
|
});
|
1292
|
-
test_utils_1.assert.isTruthy(createdUndefined);
|
1292
|
+
test_utils_1.assert.isTruthy(createdUndefined, 'upsertOne() should have returned a record.');
|
1293
1293
|
test_utils_1.assert.isTrue(createdUndefined.undefinedField === null ||
|
1294
|
-
createdUndefined.undefinedfield === null);
|
1294
|
+
createdUndefined.undefinedfield === null, 'upsertOne() should make undefined values as null.');
|
1295
1295
|
const createdNull = await db.upsertOne(this.collectionName, {
|
1296
1296
|
nullField: null,
|
1297
1297
|
name: '234',
|
@@ -1299,21 +1299,21 @@ const databaseAssertUtil = {
|
|
1299
1299
|
nullField: null,
|
1300
1300
|
name: (0, generateId_1.default)(),
|
1301
1301
|
});
|
1302
|
-
test_utils_1.assert.isTruthy(createdNull);
|
1302
|
+
test_utils_1.assert.isTruthy(createdNull, 'upsertOne() should have returned a record.');
|
1303
1303
|
let all = await db.find(this.collectionName);
|
1304
1304
|
test_utils_1.assert.isLength(all, 2, 'I expected to find 2 records after 2 upserts.');
|
1305
1305
|
const updatedUndefined = await db.upsertOne(this.collectionName, {
|
1306
1306
|
undefinedField: undefined,
|
1307
1307
|
}, { undefinedField: 'now defined' });
|
1308
|
-
test_utils_1.assert.isEqual(updatedUndefined.id, createdUndefined.id);
|
1309
|
-
test_utils_1.assert.isEqual((_a = updatedUndefined.undefinedField) !== null && _a !== void 0 ? _a : updatedUndefined.undefinedfield, 'now defined');
|
1308
|
+
test_utils_1.assert.isEqual(updatedUndefined.id, createdUndefined.id, 'upsertOne() should have returned the same record.');
|
1309
|
+
test_utils_1.assert.isEqual((_a = updatedUndefined.undefinedField) !== null && _a !== void 0 ? _a : updatedUndefined.undefinedfield, 'now defined', 'upsertOne() should have made the updates i asked for.');
|
1310
1310
|
const updatedNull = await db.upsertOne(this.collectionName, {
|
1311
1311
|
nullField: null,
|
1312
1312
|
}, { nullField: 'now defined' });
|
1313
|
-
test_utils_1.assert.isEqual(updatedNull.id, createdNull.id);
|
1314
|
-
test_utils_1.assert.isEqual((_b = updatedNull.nullField) !== null && _b !== void 0 ? _b : updatedNull.nullfield, 'now defined', '
|
1313
|
+
test_utils_1.assert.isEqual(updatedNull.id, createdNull.id, "upsertOne() should have returned the same record. I'm querying based on a null value.");
|
1314
|
+
test_utils_1.assert.isEqual((_b = updatedNull.nullField) !== null && _b !== void 0 ? _b : updatedNull.nullfield, 'now defined', 'upsertOne() should have made the updates i asked for.');
|
1315
1315
|
all = await db.find(this.collectionName);
|
1316
|
-
test_utils_1.assert.isLength(all, 2);
|
1316
|
+
test_utils_1.assert.isLength(all, 2, 'I expected to find 2 records after 2 upserts. Make sure queries are honoring null values.');
|
1317
1317
|
await this.shutdown(db);
|
1318
1318
|
},
|
1319
1319
|
async assertCanSaveAndGetNullAndUndefined(connect) {
|