water-orm
Version:
A monolith version of Standalone waterline ORM
48 lines (36 loc) • 1.24 kB
JavaScript
/*
* Module dependencies
*/
var assert = require('assert'),
bootstrapFn = require('./support/bootstrapFn');
describe('Migratable Interface', function() {
describe('migrate: "drop"', function() {
it('should have the proper migrate setting when bootstrapping', function() {
assert.equal(Migratable.Drop.migrate, 'drop');
});
it('should have tables', function(done) {
Migratable.Drop.describe(function(err, schema) {
assert.ifError(err);
assert(schema);
done();
});
});
describe('teardown and drop existing data', function() {
before(function(done) {
Migratable.Drop.create({ name: 'blackbeard' }, done);
});
it('should not retain the data when bootstrapped the second time', function(done) {
Migratable.waterline.teardown(function(err) {
bootstrapFn(function(err, obj) {
var ontology = obj.ontology;
ontology.collections.drop.count().exec(function(err, numOfPirates) {
assert.ifError(err);
assert.strictEqual(numOfPirates, 0);
done();
});
});
});
});
});
});
});