<commit_before>import assert = require('assert');
import Schema = require('../../lib/db/schema');
import Type = require('../../lib/db/schema/type');
import connection = require('../../lib/db/connection');
import db = require('../../lib/db');
import util = require('./util');

describe('db.collection', () => {
  before((done: MochaDone) => {
    util.connect(done);
  });

  after((done: MochaDone) => {
    util.close(true, done);
  });

  describe('#constructor', () => {
    it('create Collection with schema', () => {
      let userSchema = new Schema(1, {
        firstName: { type: Type.string },
        lastName: { type: Type.string },
        age: { type: Type.integer }
      });
      let userCollection = new db.Collection("beyond.user", userSchema);
      assert.equal(userCollection.constructor, db.Collection);
    });
  });
});<commit_msg>Drop collection per test case.<commit_after>import assert = require('assert');
import Schema = require('../../lib/db/schema');
import Type = require('../../lib/db/schema/type');
import connection = require('../../lib/db/connection');
import db = require('../../lib/db');
import util = require('./util');

describe('db.collection', () => {
  before((done: MochaDone) => {
    util.connect(done);
  });

  after((done: MochaDone) => {
    util.close(true, done);
  });

  beforeEach((done: MochaDone) => {
    let mongoConnection = connection.connection();
    mongoConnection.createCollection('beyondTestCollection', done);
  });

  afterEach((done: MochaDone) => {
    let mongoConnection = connection.connection();
    mongoConnection.dropCollection('beyondTestCollection', done);
  });

  describe('#constructor', () => {
    it('create Collection with schema', () => {
      let userSchema = new Schema(1, {
        firstName: { type: Type.string },
        lastName: { type: Type.string },
        age: { type: Type.integer }
      });
      let userCollection = new db.Collection("beyondTestCollection", userSchema);
      assert.equal(userCollection.constructor, db.Collection);
    });
  });
});
{'fraction_non_alphanumeric': 0.1964025279533301, 'fraction_numerical': 0.0009722897423432182, 'mean_word_length': 3.350951374207188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5793256', 'n_tokens_mistral': 599, 'n_tokens_neox': 580, 'n_words': 120}