<commit_before>describe('basic', function (){

  var app
    , obj = { first_name: 'Jean-Luc', last_name: 'Picard', id: idgen() };

  before(function (done) {
    app = require('cantina');
    app.boot(function(err) {
      app.conf.set('mongo:db', 'cantina-app-users-test-' + idgen());
      require('../');
      if (err) return done(err);
      app.start(done);
    });
  });

  after(function (done) {
    app.mongo.dropDatabase(function () {
      app.destroy(done);
    });
  });

  it('connects', function (done) {
    assert(app.collections.users);
    done();
  });

  it('works', function (done) {
    app.collections.users.create(obj, function (err, user) {
      assert.ifError(err);
      assert(user);
      for (var k in obj) {
        assert.strictEqual(user[k], obj[k]);
      }
      done();
    });
  });

  it('supports native findOne', function (done) {
    app.collections.users.findOne({ first_name: obj.first_name }, { last_name: 0 }, function (err, entity) {
      assert.ifError(err);
      assert(entity);
      assert.strictEqual(entity.id, obj.id);
      assert.strictEqual(entity.first_name, obj.first_name);
      assert.strictEqual(entity.last_name, undefined);
      done();
    });
  });

  it('supports native find', function (done) {
    app.collections.users.find().toArray(function (err, results) {
      assert.ifError(err);
      assert(results);
      assert.equal(results.length, 1);
      for (var k in obj) {
        assert.strictEqual(results[0][k], obj[k]);
      }
      done();
    });
  });
});<commit_msg>Update tests<commit_after>describe('basic', function (){

  var app
    , obj = { name: { first: 'Jean-Luc', last: 'Picard' }, username: 'captain', email: '<EMAIL>', id: idgen() };

  function assertModel (actual, expected) {
    Object.keys(expected).forEach(function (prop) {
      if (prop === '_id') {
        assert.ok(expected[prop].equal(actual[prop]));
      }
      else if (expected[prop] === Object(expected[prop])) {
        assert.deepEqual(actual[prop], expected[prop]);
      }
      else {
        assert.strictEqual(actual[prop], expected[prop]);
      }
    });
  }

  before(function (done) {
    app = require('cantina');
    app.boot(function(err) {
      app.conf.set('mongo:db', 'cantina-app-users-test-' + idgen());
      require('../');
      if (err) return done(err);
      app.start(done);
    });
  });

  after(function (done) {
    app.mongo.dropDatabase(function () {
      app.destroy(done);
    });
  });

  it('connects', function (done) {
    assert(app.collections.users);
    done();
  });

  it('works', function (done) {
    app.collections.users.create(obj, function (err, user) {
      assert.ifError(err);
      assert(user);
      assertModel(user, obj);
      done();
    });
  });

  it('supports native findOne', function (done) {
    app.collections.users.findOne({ first_name: obj.first_name }, { last_name: 0 }, function (err, entity) {
      assert.ifError(err);
      assert(entity);
      assert.strictEqual(entity.id, obj.id);
      assert.strictEqual(entity.first_name, obj.first_name);
      assert.strictEqual(entity.last_name, undefined);
      done();
    });
  });

  it('supports native find', function (done) {
    app.collections.users.find().toArray(function (err, results) {
      assert.ifError(err);
      assert(results);
      assert.equal(results.length, 1);
      assertModel(results[0], obj);
      done();
    });
  });
});
{'fraction_non_alphanumeric': 0.18313532309475514, 'fraction_numerical': 0.0017386264850767893, 'mean_word_length': 2.856983240223464, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '565685', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1126, 'n_words': 201}