Clean up collection_tests and make them DRY

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • next
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • 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.

            Assignee:
            Rosemary Yin (Inactive)
            Reporter:
            Katherine Walker (Inactive)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: