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

Commit 8085b6b1 by Meg Sharkey

fixing tests, WIP

1 parent 5703c754
......@@ -241,7 +241,8 @@ module.exports = (function() {
hashToWhereConditions: function(hash) {
return Utils._.map(hash, function(value, key) {
var _key = Utils.addTicks(key)
//handle qualified key names
var _key = key.split('.').map(function(col){return Utils.addTicks(col)}).join(".")
, _value = null
if(Array.isArray(value)) {
......
......@@ -95,8 +95,7 @@ module.exports = (function() {
optcpy = Utils._.clone(options)
optcpy.attributes = optcpy.attributes || [Utils.addTicks(this.tableName)+".*"]
return this.query(QueryGenerator.selectQuery([this.tableName, joinTableName], optcpy))
return this.QueryInterface.select(this, [this.tableName, joinTableName], optcpy)
}
ModelFactory.prototype.find = function(options) {
......
......@@ -95,22 +95,6 @@ describe('HasMany', function() {
})
describe("when a join table name is specified", function() {
var Table2 = sequelize.define('ms_table1', {foo: Sequelize.STRING})
, Table1 = sequelize.define('ms_table2', {foo: Sequelize.STRING})
Table1.hasMany(Table2, {joinTableName: 'table1_to_table2'})
Table2.hasMany(Table1, {joinTableName: 'table1_to_table2'})
it("should not use a combined name", function() {
expect(sequelize.modelManager.getModel('ms_table1sms_table2s')).toBeUndefined()
})
it("should use the specified name", function() {
expect(sequelize.modelManager.getModel('table1_to_table2')).toBeDefined()
})
})
describe('bi-directional', function() {
it('adds the foreign key', function() {
Task.hasMany(User)
......
......@@ -32,10 +32,10 @@ describe('Associations', function() {
Table2.hasMany(Table1, {joinTableName: 'table1_to_table2'})
it("should not use a combined name", function() {
expect(sequelize.modelManager.getModel('ms_table1sms_table2s')).toBeUndefined()
expect(sequelize.modelFactoryManager.getModel('ms_table1sms_table2s')).toBeUndefined()
})
it("should use the specified name", function() {
expect(sequelize.modelManager.getModel('table1_to_table2')).toBeDefined()
expect(sequelize.modelFactoryManager.getModel('table1_to_table2')).toBeDefined()
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!