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

Commit d12b30ce by sdepold

specs for addIndex and showIndex

1 parent 284a7856
Showing with 28 additions and 1 deletions
...@@ -5,7 +5,6 @@ var config = require("./config/config") ...@@ -5,7 +5,6 @@ var config = require("./config/config")
, QueryInterface = require("../lib/query-interface") , QueryInterface = require("../lib/query-interface")
describe('QueryInterface', function() { describe('QueryInterface', function() {
describe('dropAllTables', function() {
var interface = null var interface = null
beforeEach(function() { beforeEach(function() {
...@@ -18,6 +17,7 @@ describe('QueryInterface', function() { ...@@ -18,6 +17,7 @@ describe('QueryInterface', function() {
Helpers.dropAllTables() Helpers.dropAllTables()
}) })
describe('dropAllTables', function() {
it("should drop all tables", function() { it("should drop all tables", function() {
Helpers.async(function(done) { Helpers.async(function(done) {
interface.dropAllTables().success(done).error(function(err) { console.log(err) }) interface.dropAllTables().success(done).error(function(err) { console.log(err) })
...@@ -55,4 +55,31 @@ describe('QueryInterface', function() { ...@@ -55,4 +55,31 @@ describe('QueryInterface', function() {
}) })
}) })
}) })
describe('addIndex', function() {
beforeEach(function(){
Helpers.async(function(done) {
interface.createTable('User', {
username: Sequelize.STRING,
isAdmin: Sequelize.BOOLEAN
}).success(done)
})
})
it('adds an index to the table', function() {
Helpers.async(function(done) {
interface.addIndex('User', ['username', 'isAdmin']).success(done).error(function(err) {
console.log(err)
})
})
Helpers.async(function(done) {
interface.showIndex('User').success(function(indexes) {
var indexColumns = indexes.map(function(index) { return index.Column_name }).sort()
expect(indexColumns).toEqual(['isAdmin', 'username'])
done()
}).error(function(err) { console.log(err) })
})
})
})
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!