sails-hook-migrate
Version:
Uses db-migrate to handle sails migration more efficiently/safely
48 lines (38 loc) • 1.05 kB
JavaScript
var Sails = require('sails').Sails;
const path = require('path');
describe('Basic tests ::', function() {
// Var to hold a running sails app instance
var sails;
// Before running any tests, attempt to lift Sails
before(function (done) {
// Hook will timeout in 30 seconds
this.timeout(61000);
// Attempt to lift sails
Sails().lift({
hooks: {
// Load the hook
"migrate": require(path.join(__dirname,'..','index.js')),
// Skip grunt (unless your hook uses it)
"grunt": false
},
log: {level: "error"}
},function (err, _sails) {
if (err) return done(err);
sails = _sails;
return done();
});
});
// After tests are complete, lower Sails
after(function (done) {
// Lower Sails (if it successfully lifted)
if (sails) {
return sails.lower(done);
}
// Otherwise just return
return done();
});
// Test that Sails can lift with the hook in place
it ('sails does not crash', function() {
return true;
});
});