var MongoClient = require('../../').MongoClient,
  expect = require('chai').expect;

function connectToDb(url, db, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {};
  }

  MongoClient.connect(url, options || {}, function(err, client) {
    if (err) return callback(err);
    callback(null, client.db(db), client);
  });
}

function setupDatabase(configuration) {
  var dbName = configuration.db;
  var client = configuration.newClient(configuration.writeConcernMax(), {
    poolSize: 1
  });

  return client.connect().then(function() {
    var db = client.db(dbName);
    return db.dropDatabase();
  });
}

var assert = {
  equal: function(a, b) {
    expect(a).to.equal(b);
  },

  deepEqual: function(a, b) {
    expect(a).to.eql(b);
  },

  ok: function(a) {
    expect(a).to.be.ok;
  }
};

module.exports = {
  connectToDb: connectToDb,
  setupDatabase: setupDatabase,
  assert: assert
};

@@ -614,16 +614,153 @@
 bName);%0A
+    return db%0A      .command(%7B%0A        dropAllUsersFromDatabase: 1,%0A        writeConcern: %7B w: 1 %7D%0A      %7D)%0A      .then(function() %7B%0A    
     retu
@@ -781,16 +781,26 @@
 base();%0A
+      %7D);%0A
   %7D);%0A%7D%0A
@@ -951,24 +951,24 @@
 nction(a) %7B%0A
-
     expect(a
@@ -979,16 +979,76 @@
 .be.ok;%0A
+  %7D,%0A%0A  throws: function(func) %7B%0A    expect(func).to.throw;%0A
   %7D%0A%7D;%0A%0A

add `throws` assertion, drop all users