不要怂,就是干,撸起袖子干!

Commit 86b36804 by sdepold

spec for dropAllTables

1 parent 9e17fbbe
Showing with 53 additions and 0 deletions
var config = require("./config/config")
, Sequelize = require("../index")
, sequelize = new Sequelize(config.database, config.username, config.password, { logging: false })
, Helpers = new (require("./config/helpers"))(sequelize)
, QueryInterface = require("../lib/query-interface")
describe('QueryInterface', function() {
describe('dropAllTables', function() {
var interface = null
beforeEach(function() {
interface = sequelize.getQueryInterface()
Helpers.async(function(done) {
interface.dropAllTables().success(done).error(function(err) { console.log(err) })
})
})
afterEach(function() { interface = null })
it("should drop all tables", function() {
Helpers.async(function(done) {
interface.showAllTables().success(function(tableNames) {
expect(tableNames.length).toEqual(0)
done()
})
})
Helpers.async(function(done) {
interface.createTable('table', { name: Sequelize.STRING })
.success(done)
.error(function(err){ console.log(err)})
})
Helpers.async(function(done) {
interface.showAllTables().success(function(tableNames) {
expect(tableNames.length).toEqual(1)
done()
})
})
Helpers.async(function(done) {
interface.dropAllTables().success(done).error(function(err) { console.log(err) })
})
Helpers.async(function(done) {
interface.showAllTables().success(function(tableNames) {
expect(tableNames.length).toEqual(0)
done()
})
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!