- fix test: 'mongo-livedata - rewrite selector MONGO | STRING'

This commit is contained in:
denihs
2023-02-15 14:10:39 -04:00
parent 2d12179404
commit a263c16a7c

View File

@@ -2769,27 +2769,23 @@ _.each( ['STRING', 'MONGO'], function(idGeneration) {
}); // end idGeneration parametrization
Tinytest.add('mongo-livedata - rewrite selector', function (test) {
test.equal(Mongo.Collection._rewriteSelector('foo'),
{_id: 'foo'});
Tinytest.add('mongo-livedata - rewrite selector', function(test) {
test.equal(Mongo.Collection._rewriteSelector('foo'), { _id: 'foo' });
var oid = new Mongo.ObjectID();
test.equal(Mongo.Collection._rewriteSelector(oid),
{_id: oid});
test.equal(Mongo.Collection._rewriteSelector(oid), { _id: oid });
test.matches(
Mongo.Collection._rewriteSelector({ _id: null })._id,
/^\S+$/,
'Passing in a falsey selector _id should return a selector with a new '
+ 'auto-generated _id string'
'Passing in a falsey selector _id should return a selector with a new ' +
'auto-generated _id string'
);
test.equal(
Mongo.Collection._rewriteSelector({ _id: null }, { fallbackId: oid }),
{ _id: oid },
'Passing in a falsey selector _id and a fallback ID should return a '
+ 'selector with an _id using the fallback ID'
'Passing in a falsey selector _id and a fallback ID should return a ' +
'selector with an _id using the fallback ID'
);
});