-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
collection_tests has a lot of duplication that we can reduce. Most of the tests follow this pattern:
var self = this; var client = self.configuration.newClient(); client.connect(function(err, client) { var db = client.db(self.configuration.db); db.createCollection('test_collection_methods', function(err, collection) { test.equal('test_collection_methods', collection.collectionName); // some operation }); });
We can move this common behavior into beforeEach to reduce duplication across tests that follow this pattern. While doing that, we can also replace var with const or let as needed, eliminate the use of self, and switch to arrow functions.