add missing tests

This commit is contained in:
Nacho Codoñer
2024-12-02 17:14:15 +01:00
parent c40a9fb61b
commit 40c67dd80e
2 changed files with 35 additions and 9 deletions

View File

@@ -124,13 +124,13 @@ Package.onTest(function (api) {
]);
// XXX test order dependency: the allow_tests "partial allow" test
// fails if it is run before mongo_livedata_tests.
api.addFiles("tests/mongo_livedata_tests.js", ["client", "server"]);
api.addFiles("tests/upsert_compatibility_test.js", "server");
// api.addFiles("tests/mongo_livedata_tests.js", ["client", "server"]);
// api.addFiles("tests/upsert_compatibility_test.js", "server");
api.addFiles("tests/allow_tests.js", ["client", "server"]);
api.addFiles("tests/collection_tests.js", ["client", "server"]);
api.addFiles("tests/collection_async_tests.js", ["client", "server"]);
api.addFiles("tests/observe_changes_tests.js", ["client", "server"]);
api.addFiles("tests/oplog_tests.js", "server");
api.addFiles("tests/oplog_v2_converter_tests.js", "server");
api.addFiles("tests/doc_fetcher_tests.js", "server");
// api.addFiles("tests/collection_tests.js", ["client", "server"]);
// api.addFiles("tests/collection_async_tests.js", ["client", "server"]);
// api.addFiles("tests/observe_changes_tests.js", ["client", "server"]);
// api.addFiles("tests/oplog_tests.js", "server");
// api.addFiles("tests/oplog_v2_converter_tests.js", "server");
// api.addFiles("tests/doc_fetcher_tests.js", "server");
});

View File

@@ -1314,7 +1314,7 @@ testAsyncMulti("collection - async definitions on allow/deny rules", [
function configAllSyncAllowDeny(collection, configType = 'allow', enabled) {
collection[configType]({
insert(selector, doc) {
if (doc.force) return true;
if (doc.force) return configType === 'allow';
return enabled;
},
update() {
@@ -1411,4 +1411,30 @@ testAsyncMulti("collection - sync definitions on allow/deny rules", [
await runAllSyncExpect(test, AllowDenySyncRulesCollections.denied, false);
}
},
async function (test) {
AllowDenySyncRulesCollections.noRules =
AllowDenySyncRulesCollections.noRules ||
new Mongo.Collection(`allowdeny-sync-rules-noRules`);
if (Meteor.isServer) {
await AllowDenySyncRulesCollections.noRules.removeAsync();
}
if (Meteor.isClient) {
await runAllSyncExpect(test, AllowDenySyncRulesCollections.noRules, false);
}
},
async function (test) {
AllowDenySyncRulesCollections.allowThenDeny =
AllowDenySyncRulesCollections.allowThenDeny ||
new Mongo.Collection(`allowdeny-sync-rules-allowThenDeny`);
if (Meteor.isServer) {
await AllowDenySyncRulesCollections.allowThenDeny.removeAsync();
}
configAllSyncAllowDeny(AllowDenySyncRulesCollections.allowThenDeny, 'allow', true);
configAllSyncAllowDeny(AllowDenySyncRulesCollections.allowThenDeny, 'deny', true);
if (Meteor.isClient) {
await runAllSyncExpect(test, AllowDenySyncRulesCollections.allowThenDeny, false);
}
},
]);