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

Commit 3002d11e by sdepold

remove index spec

1 parent d12b30ce
......@@ -157,8 +157,9 @@ module.exports = (function() {
return queryAndEmit.call(this, sql, 'showIndex')
}
QueryInterface.prototype.removeIndex = function() {
QueryInterface.prototype.removeIndex = function(tableName, indexNameOrAttributes) {
var sql = this.QueryGenerator.removeIndexQuery(tableName, indexNameOrAttributes)
return queryAndEmit.call(this, sql, "removeIndex")
}
QueryInterface.prototype.insert = function(model, tableName, values) {
......
......@@ -56,7 +56,7 @@ describe('QueryInterface', function() {
})
})
describe('addIndex', function() {
describe('indexes', function() {
beforeEach(function(){
Helpers.async(function(done) {
interface.createTable('User', {
......@@ -66,7 +66,7 @@ describe('QueryInterface', function() {
})
})
it('adds an index to the table', function() {
it('adds, reads and removes an index to the table', function() {
Helpers.async(function(done) {
interface.addIndex('User', ['username', 'isAdmin']).success(done).error(function(err) {
console.log(err)
......@@ -80,6 +80,20 @@ describe('QueryInterface', function() {
done()
}).error(function(err) { console.log(err) })
})
Helpers.async(function(done) {
interface.removeIndex('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([])
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!