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

Commit 51035b13 by Jan Aagaard Meier

More changelog entries to the correct place, fix the remaining test

1 parent 2210ce44
...@@ -2,7 +2,16 @@ Notice: All 1.7.x changes are present in 2.0.x aswell ...@@ -2,7 +2,16 @@ Notice: All 1.7.x changes are present in 2.0.x aswell
# Next # Next
- [FEATURE] Added to option of setting a timezone offset in the sequelize constructor (`timezone` option). This timezone is used when initializing a connection (using `SET TIME ZONE` or equivalent), and when converting a timestamp string from the DB to a JS date with mysql (postgres stores the timezone, so for postgres we rely on what's in the DB). - [FEATURE] Added to option of setting a timezone offset in the sequelize constructor (`timezone` option). This timezone is used when initializing a connection (using `SET TIME ZONE` or equivalent), and when converting a timestamp string from the DB to a JS date with mysql (postgres stores the timezone, so for postgres we rely on what's in the DB).
- [FEATURE] Allow setting plural and singular name on the model (`options.name` in `sequelize.define`) and in associations (`options.as`) to circumvent issues with weird pluralization.
- [INTERNALS] Replaced lingo with inflection
- [INTERNALS] Removed underscore.string dependency and moved a couple of helper functions from `Utils._` to `Utils`
#### Backwards compatability changes
- We are using a new inflection library, which should make pluralization and singularization in general more robust. However, a couple of pluralizations have changed as a result:
+ Person is now pluralized as people instead of persons
- Accesors for models with underscored names are no longer camel cased automatically. For example, if you have a model with name `my_model`, and `my_other_model.hasMany(my_model)`, the getter will now be `instance_of_my_model.getMy_model` instead of `.getMyModel`.
- Removed support for setting sequelize.language. If your model names are not in english, use the name option provided by `sequelize.name` to defined singular and plural forms for your model.
- Model names are now used more verbatim in associations. This means that if you have a model named `Task` (plural T), or an association specifying `{ as: 'Task' }`, the tasks will be returned as `relatedModel.Tasks` instead of `relatedModel.tasks`. For more information and how to mitigate this, see https://github.com/sequelize/sequelize/wiki/Upgrading-to-2.0#inflection-replaces-lingo-and-changes-to-naming-conventions
# v2.0.0-dev12 # v2.0.0-dev12
- [FEATURE] You can now return a promise to a hook rather than use a callback - [FEATURE] You can now return a promise to a hook rather than use a callback
...@@ -24,9 +33,6 @@ Notice: All 1.7.x changes are present in 2.0.x aswell ...@@ -24,9 +33,6 @@ Notice: All 1.7.x changes are present in 2.0.x aswell
- [BUG] Use the provided name for a unique index if one is given, instead of concating the column names together [#1944](https://github.com/sequelize/sequelize/issues/1944) - [BUG] Use the provided name for a unique index if one is given, instead of concating the column names together [#1944](https://github.com/sequelize/sequelize/issues/1944)
- [BUG] Create a composite primary key for doubled linked self reference [#1891](https://github.com/sequelize/sequelize/issues/1891) - [BUG] Create a composite primary key for doubled linked self reference [#1891](https://github.com/sequelize/sequelize/issues/1891)
- [INTERNALS] `bulkDeleteQuery` was removed from the MySQL / abstract query generator, since it was never used internally. Please use `deleteQuery` instead. - [INTERNALS] `bulkDeleteQuery` was removed from the MySQL / abstract query generator, since it was never used internally. Please use `deleteQuery` instead.
- [INTERNALS] Replaced lingo with inflection
- [INTERNALS] Removed underscore.string dependency and moved a couple of helper functions from `Utils._` to `Utils`
#### Backwards compatability changes #### Backwards compatability changes
- Sequelize now returns promises instead of its custom event emitter from most calls. This affects methods that return multiple values (like `findOrCreate` or `findOrInitialize`). If your current callbacks do not accept the 2nd success parameter you might be seeing an array as the first param. Either use `.spread()` for these methods or add another argument to your callback: `.success(instance)` -> `.success(instance, created)`. - Sequelize now returns promises instead of its custom event emitter from most calls. This affects methods that return multiple values (like `findOrCreate` or `findOrInitialize`). If your current callbacks do not accept the 2nd success parameter you might be seeing an array as the first param. Either use `.spread()` for these methods or add another argument to your callback: `.success(instance)` -> `.success(instance, created)`.
...@@ -37,10 +43,6 @@ Notice: All 1.7.x changes are present in 2.0.x aswell ...@@ -37,10 +43,6 @@ Notice: All 1.7.x changes are present in 2.0.x aswell
- `sequelize.transaction()` now returns a promise rather than a instance of Sequelize.Transaction - `sequelize.transaction()` now returns a promise rather than a instance of Sequelize.Transaction
- `bulkCreate`, `bulkUpdate` and `bulkDestroy` (and aliases) now take both a `hooks` and an `individualHooks` option, `hooks` defines whether or not to run the main hooks, and `individualHooks` defines whether to run hooks for each instance affected. - `bulkCreate`, `bulkUpdate` and `bulkDestroy` (and aliases) now take both a `hooks` and an `individualHooks` option, `hooks` defines whether or not to run the main hooks, and `individualHooks` defines whether to run hooks for each instance affected.
- It is no longer possible to disable pooling, disable pooling will just result in a 1/1 pool. - It is no longer possible to disable pooling, disable pooling will just result in a 1/1 pool.
- We are using a new inflection library, which should make pluralization and singularization in general more robust. However, a couple of pluralizations have changed as a result:
+ Person is now pluralized as people instead of persons
- Accesors for models with underscored names are no longer camel cased automatically. For example, if you have a model with name `my_model`, and `my_other_model` hasMany `my_model`, the getter will now be `getMy_model` instead of `getMyModel`.
- Removed support for setting sequelize.language. If your model names are not in english, use the name option provided by `sequelize.name` to defined singular and plural forms for your model.
# v2.0.0-dev11 # v2.0.0-dev11
### Caution: This release contains many changes and is highly experimental ### Caution: This release contains many changes and is highly experimental
......
...@@ -632,4 +632,3 @@ Utils.col.prototype.toString = function(queryGenerator, parentModel) { ...@@ -632,4 +632,3 @@ Utils.col.prototype.toString = function(queryGenerator, parentModel) {
Utils.CustomEventEmitter = require(__dirname + '/emitters/custom-event-emitter'); Utils.CustomEventEmitter = require(__dirname + '/emitters/custom-event-emitter');
Utils.Promise = require(__dirname + '/promise'); Utils.Promise = require(__dirname + '/promise');
Utils.QueryChainer = require(__dirname + '/query-chainer'); Utils.QueryChainer = require(__dirname + '/query-chainer');
Utils.Lingo = require('lingo');
"use strict";
/* jshint camelcase: false, expr: true */
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../support')
, DataTypes = require(__dirname + "/../../lib/data-types")
, Sequelize = require('../../index')
, Promise = Sequelize.Promise
, assert = require('assert');
chai.config.includeStack = true;
describe(Support.getTestDialectTeaser("Alias"), function() {
it('should uppercase the first letter in alias getter, but not in eager loading', function () {
var User = this.sequelize.define('user', {})
, Task = this.sequelize.define('task', {});
User.hasMany(Task, { as: 'assignments', foreignKey: 'userId' });
Task.belongsTo(User, { as: 'owner', foreignKey: 'userId' });
return this.sequelize.sync({ force: true }).then(function () {
return Promise.all([
User.create({ id: 1 }),
Task.create({ id: 1, userId: 1 })
]);
}).spread(function (user, task) {
expect(user.getAssignments).to.be.ok;
expect(task.getOwner).to.be.ok;
}).then(function () {
return Promise.all([
User.find({ where: { id: 1 }, include: [{model: Task, as: 'assignments'}] }),
Task.find({ where: { id: 1 }, include: [{model: User, as: 'owner'}] }),
]);
}).spread(function (user, task) {
expect(user.assignments).to.be.ok;
expect(task.owner).to.be.ok;
});
});
it('shouldnt touch the passed alias', function () {
var User = this.sequelize.define('user', {})
, Task = this.sequelize.define('task', {});
User.hasMany(Task, { as: 'ASSIGNMENTS', foreignKey: 'userId' });
Task.belongsTo(User, { as: 'OWNER', foreignKey: 'userId' });
return this.sequelize.sync({ force: true }).then(function () {
return User.create({ id: 1 });
}).then(function (user){
expect(user.getASSIGNMENTS).to.be.ok;
return Task.create({ id: 1, userId: 1 });
}).then(function (task) {
expect(task.getOWNER).to.be.ok;
return Promise.all([
User.find({ where: { id: 1 }, include: [{model: Task, as: 'ASSIGNMENTS'}] }),
Task.find({ where: { id: 1 }, include: [{model: User, as: 'OWNER'}] }),
]);
}).spread(function (user, task) {
expect(user.ASSIGNMENTS).to.be.ok;
expect(task.OWNER).to.be.ok;
});
});
it('should allow me to pass my own plural and singular forms to hasMany', function () {
var User = this.sequelize.define('user', {})
, Task = this.sequelize.define('task', {});
User.hasMany(Task, { as: { singular: 'task', plural: 'taskz'} });
return this.sequelize.sync({ force: true }).then(function () {
return Promise.all([
User.create({ id: 1 }),
]);
}).spread(function (user, task) {
expect(user.getTaskz).to.be.ok;
expect(user.addTask).to.be.ok;
expect(user.addTaskz).to.be.ok;
}).then(function () {
return Promise.all([
User.find({ where: { id: 1 }, include: [{model: Task, as: 'taskz'}] }),
]);
}).spread(function (user, task) {
expect(user.taskz).to.be.ok;
});
});
it('should allow me to define plural and singular forms on the model', function () {
var User = this.sequelize.define('user', {})
, Task = this.sequelize.define('task', {}, {
name: {
singular: 'assignment',
plural: 'assignments'
}
});
User.hasMany(Task);
return this.sequelize.sync({ force: true }).then(function () {
return Promise.all([
User.create({ id: 1 }),
]);
}).spread(function (user, task) {
expect(user.getAssignments).to.be.ok;
expect(user.addAssignment).to.be.ok;
expect(user.addAssignments).to.be.ok;
}).then(function () {
return Promise.all([
User.find({ where: { id: 1 }, include: [Task] }),
]);
}).spread(function (user, task) {
expect(user.assignments).to.be.ok;
});
});
});
...@@ -465,11 +465,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -465,11 +465,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
var product = Product.build({ var product = Product.build({
id: 1, id: 1,
title: 'Chair', title: 'Chair',
tags: [ Tags: [
{id: 1, name: 'Alpha'}, {id: 1, name: 'Alpha'},
{id: 2, name: 'Beta'} {id: 2, name: 'Beta'}
], ],
user: { User: {
id: 1, id: 1,
first_name: 'Mick', first_name: 'Mick',
last_name: 'Hansen' last_name: 'Hansen'
...@@ -527,8 +527,8 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -527,8 +527,8 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
] ]
}, { }, {
include: [ include: [
{model: User, as: 'Followers'}, {model: User, as: 'followers'},
{model: Tag, as: 'Categories'} {model: Tag, as: 'categories'}
] ]
}) })
......
...@@ -1226,14 +1226,14 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -1226,14 +1226,14 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
self.User.findAll({include: [ { model: self.Project, as: 'Projects' } ]}).success(function(users) { self.User.findAll({include: [ { model: self.Project, as: 'Projects' } ]}).success(function(users) {
var _user = users[0] var _user = users[0]
expect(_user.projects).to.exist expect(_user.Projects).to.exist
expect(JSON.parse(JSON.stringify(_user)).projects).to.exist expect(JSON.parse(JSON.stringify(_user)).Projects).to.exist
self.Project.findAll({include: [ { model: self.User, as: 'LovelyUser' } ]}).success(function(projects) { self.Project.findAll({include: [ { model: self.User, as: 'LovelyUser' } ]}).success(function(projects) {
var _project = projects[0] var _project = projects[0]
expect(_project.lovelyUser).to.exist expect(_project.LovelyUser).to.exist
expect(JSON.parse(JSON.stringify(_project)).lovelyUser).to.exist expect(JSON.parse(JSON.stringify(_project)).LovelyUser).to.exist
done() done()
}) })
......
...@@ -139,8 +139,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -139,8 +139,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
] ]
}).done(function (err, task) { }).done(function (err, task) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(task.user).to.be.ok expect(task.User).to.be.ok
expect(task.group).to.be.ok expect(task.Group).to.be.ok
done() done()
}) })
}) })
...@@ -187,7 +187,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -187,7 +187,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, group) { }).done(function (err, group) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(group.User).to.be.ok expect(group.User).to.be.ok
expect(group.User.task).to.be.ok expect(group.User.Task).to.be.ok
done() done()
}) })
}) })
...@@ -240,7 +240,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -240,7 +240,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(user.Tasks).to.be.ok expect(user.Tasks).to.be.ok
expect(user.Tasks.length).to.equal(4) expect(user.Tasks.length).to.equal(4)
user.tasks.forEach(function (task) { user.Tasks.forEach(function (task) {
expect(task.Project).to.be.ok expect(task.Project).to.be.ok
}) })
...@@ -295,8 +295,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -295,8 +295,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, worker) { }).done(function (err, worker) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(worker.Project).to.be.ok expect(worker.Project).to.be.ok
expect(worker.Project.tasks).to.be.ok expect(worker.Project.Tasks).to.be.ok
expect(worker.Project.tasks.length).to.equal(4) expect(worker.Project.Tasks.length).to.equal(4)
done() done()
}) })
...@@ -373,10 +373,10 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -373,10 +373,10 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(user.Products.length).to.equal(4) expect(user.Products.length).to.equal(4)
expect(user.Products[0].tags.length).to.equal(2) expect(user.Products[0].Tags.length).to.equal(2)
expect(user.Products[1].tags.length).to.equal(1) expect(user.Products[1].Tags.length).to.equal(1)
expect(user.Products[2].tags.length).to.equal(3) expect(user.Products[2].Tags.length).to.equal(3)
expect(user.Products[3].tags.length).to.equal(0) expect(user.Products[3].Tags.length).to.equal(0)
done() done()
}) })
}) })
...@@ -516,20 +516,20 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -516,20 +516,20 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, user) { }).done(function (err, user) {
user.Memberships.sort(sortById) user.Memberships.sort(sortById)
expect(user.Memberships.length).to.equal(2) expect(user.Memberships.length).to.equal(2)
expect(user.Memberships[0].group.name).to.equal('Developers') expect(user.Memberships[0].Group.name).to.equal('Developers')
expect(user.Memberships[0].rank.canRemove).to.equal(1) expect(user.Memberships[0].Rank.canRemove).to.equal(1)
expect(user.Memberships[1].group.name).to.equal('Designers') expect(user.Memberships[1].Group.name).to.equal('Designers')
expect(user.Memberships[1].rank.canRemove).to.equal(0) expect(user.Memberships[1].Rank.canRemove).to.equal(0)
user.Products.sort(sortById) user.Products.sort(sortById)
expect(user.Products.length).to.equal(2) expect(user.Products.length).to.equal(2)
expect(user.Products[0].tags.length).to.equal(2) expect(user.Products[0].Tags.length).to.equal(2)
expect(user.Products[1].tags.length).to.equal(1) expect(user.Products[1].Tags.length).to.equal(1)
expect(user.Products[0].category).to.be.ok expect(user.Products[0].Category).to.be.ok
expect(user.Products[1].category).not.to.be.ok expect(user.Products[1].Category).not.to.be.ok
expect(user.Products[0].prices.length).to.equal(2) expect(user.Products[0].Prices.length).to.equal(2)
expect(user.Products[1].prices.length).to.equal(4) expect(user.Products[1].Prices.length).to.equal(4)
done() done()
}) })
...@@ -566,7 +566,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -566,7 +566,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(tasks[0].title).to.equal('FooBar') expect(tasks[0].title).to.equal('FooBar')
expect(tasks[0].Project.title).to.equal('BarFoo'); expect(tasks[0].Project.title).to.equal('BarFoo');
expect(_.omit(tasks[0].get(), 'project')).to.deep.equal({ title: 'FooBar' }) expect(_.omit(tasks[0].get(), 'Project')).to.deep.equal({ title: 'FooBar' })
expect(tasks[0].Project.get()).to.deep.equal({ title: 'BarFoo'}) expect(tasks[0].Project.get()).to.deep.equal({ title: 'BarFoo'})
done() done()
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
var chai = require('chai') var chai = require('chai')
, expect = chai.expect , expect = chai.expect
, Support = require(__dirname + '/../support') , Support = require(__dirname + '/../support')
, Sequelize = require(__dirname + '/../../index')
, DataTypes = require(__dirname + "/../../lib/data-types") , DataTypes = require(__dirname + "/../../lib/data-types")
, datetime = require('chai-datetime') , datetime = require('chai-datetime')
, async = require('async'); , async = require('async');
...@@ -52,10 +53,10 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -52,10 +53,10 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}); });
it("should still pull the main record when an included model is not required and has where restrictions without matches", function () { it("should still pull the main record when an included model is not required and has where restrictions without matches", function () {
var A = this.sequelize.define('A', { var A = this.sequelize.define('a', {
name: DataTypes.STRING(40) name: DataTypes.STRING(40)
}) })
, B = this.sequelize.define('B', { , B = this.sequelize.define('b', {
name: DataTypes.STRING(40) name: DataTypes.STRING(40)
}); });
...@@ -84,16 +85,16 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -84,16 +85,16 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}); });
it('should support many levels of belongsTo (with a lower level having a where)', function (done) { it('should support many levels of belongsTo (with a lower level having a where)', function (done) {
var A = this.sequelize.define('A', {}) var A = this.sequelize.define('a', {})
, B = this.sequelize.define('B', {}) , B = this.sequelize.define('b', {})
, C = this.sequelize.define('C', {}) , C = this.sequelize.define('c', {})
, D = this.sequelize.define('D', {}) , D = this.sequelize.define('d', {})
, E = this.sequelize.define('E', {}) , E = this.sequelize.define('e', {})
, F = this.sequelize.define('F', {}) , F = this.sequelize.define('f', {})
, G = this.sequelize.define('G', { , G = this.sequelize.define('g', {
name: DataTypes.STRING name: DataTypes.STRING
}) })
, H = this.sequelize.define('H', { , H = this.sequelize.define('h', {
name: DataTypes.STRING name: DataTypes.STRING
}); });
...@@ -126,12 +127,12 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -126,12 +127,12 @@ describe(Support.getTestDialectTeaser("Include"), function () {
async.eachSeries(singles, function (model, callback) { async.eachSeries(singles, function (model, callback) {
var values = {}; var values = {};
if (model.name === 'G') { if (model.name === 'g') {
values.name = 'yolo'; values.name = 'yolo';
} }
model.create(values).done(function (err, instance) { model.create(values).done(function (err, instance) {
if (previousInstance) { if (previousInstance) {
previousInstance["set"+model.name](instance).done(function () { previousInstance["set"+Sequelize.Utils.uppercaseFirst(model.name)](instance).done(function () {
previousInstance = instance; previousInstance = instance;
callback(); callback();
}); });
......
...@@ -394,23 +394,23 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -394,23 +394,23 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
user.memberships.sort(sortById) user.Memberships.sort(sortById)
expect(user.memberships.length).to.equal(2) expect(user.Memberships.length).to.equal(2)
expect(user.memberships[0].group.name).to.equal('Developers') expect(user.Memberships[0].Group.name).to.equal('Developers')
expect(user.memberships[0].rank.canRemove).to.equal(1) expect(user.Memberships[0].Rank.canRemove).to.equal(1)
expect(user.memberships[1].group.name).to.equal('Designers') expect(user.Memberships[1].Group.name).to.equal('Designers')
expect(user.memberships[1].rank.canRemove).to.equal(0) expect(user.Memberships[1].Rank.canRemove).to.equal(0)
user.products.sort(sortById) user.Products.sort(sortById)
expect(user.products.length).to.equal(2) expect(user.Products.length).to.equal(2)
expect(user.products[0].tags.length).to.equal(2) expect(user.Products[0].Tags.length).to.equal(2)
expect(user.products[1].tags.length).to.equal(1) expect(user.Products[1].Tags.length).to.equal(1)
expect(user.products[0].category).to.be.ok expect(user.Products[0].Category).to.be.ok
expect(user.products[1].category).not.to.be.ok expect(user.Products[1].Category).not.to.be.ok
expect(user.products[0].prices.length).to.equal(2) expect(user.Products[0].Prices.length).to.equal(2)
expect(user.products[1].prices.length).to.equal(4) expect(user.Products[1].Prices.length).to.equal(4)
done() done()
}) })
...@@ -423,14 +423,14 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -423,14 +423,14 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}) })
it('should support many levels of belongsTo', function (done) { it('should support many levels of belongsTo', function (done) {
var A = this.sequelize.define('A', {}) var A = this.sequelize.define('a', {})
, B = this.sequelize.define('B', {}) , B = this.sequelize.define('b', {})
, C = this.sequelize.define('C', {}) , C = this.sequelize.define('c', {})
, D = this.sequelize.define('D', {}) , D = this.sequelize.define('d', {})
, E = this.sequelize.define('E', {}) , E = this.sequelize.define('e', {})
, F = this.sequelize.define('F', {}) , F = this.sequelize.define('f', {})
, G = this.sequelize.define('G', {}) , G = this.sequelize.define('g', {})
, H = this.sequelize.define('H', {}) , H = this.sequelize.define('h', {})
A.belongsTo(B) A.belongsTo(B)
B.belongsTo(C) B.belongsTo(C)
...@@ -472,7 +472,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -472,7 +472,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
async.eachSeries(singles, function (model, callback) { async.eachSeries(singles, function (model, callback) {
model.create({}).done(function (err, instance) { model.create({}).done(function (err, instance) {
if (previousInstance) { if (previousInstance) {
previousInstance["set"+model.name](instance).done(function () { previousInstance["set"+Sequelize.Utils.uppercaseFirst(model.name)](instance).done(function () {
previousInstance = instance previousInstance = instance
callback() callback()
}) })
...@@ -524,16 +524,16 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -524,16 +524,16 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}) })
it('should support many levels of belongsTo (with a lower level having a where)', function (done) { it('should support many levels of belongsTo (with a lower level having a where)', function (done) {
var A = this.sequelize.define('A', {}) var A = this.sequelize.define('a', {})
, B = this.sequelize.define('B', {}) , B = this.sequelize.define('b', {})
, C = this.sequelize.define('C', {}) , C = this.sequelize.define('c', {})
, D = this.sequelize.define('D', {}) , D = this.sequelize.define('d', {})
, E = this.sequelize.define('E', {}) , E = this.sequelize.define('e', {})
, F = this.sequelize.define('F', {}) , F = this.sequelize.define('f', {})
, G = this.sequelize.define('G', { , G = this.sequelize.define('g', {
name: DataTypes.STRING name: DataTypes.STRING
}) })
, H = this.sequelize.define('H', { , H = this.sequelize.define('h', {
name: DataTypes.STRING name: DataTypes.STRING
}) })
...@@ -577,12 +577,12 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -577,12 +577,12 @@ describe(Support.getTestDialectTeaser("Include"), function () {
async.eachSeries(singles, function (model, callback) { async.eachSeries(singles, function (model, callback) {
var values = {}; var values = {};
if (model.name === 'G') { if (model.name === 'g') {
values.name = 'yolo'; values.name = 'yolo';
} }
model.create(values).done(function (err, instance) { model.create(values).done(function (err, instance) {
if (previousInstance) { if (previousInstance) {
previousInstance["set"+model.name](instance).done(function () { previousInstance["set"+Sequelize.Utils.uppercaseFirst(model.name)](instance).done(function () {
previousInstance = instance previousInstance = instance
callback() callback()
}) })
...@@ -715,8 +715,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -715,8 +715,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(as[0].itemA.test).to.eql('abc') expect(as[0].itemA.test).to.eql('abc')
expect(as[1].itemA.test).to.eql('abc') expect(as[1].itemA.test).to.eql('abc')
expect(as[0].order.position).to.eql(1) expect(as[0].Order.position).to.eql(1)
expect(as[1].order.position).to.eql(2) expect(as[1].Order.position).to.eql(2)
done() done()
}) })
...@@ -786,14 +786,14 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -786,14 +786,14 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, products) { }).done(function (err, products) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(products[0].tags[0].productTag.priority).to.equal(1) expect(products[0].Tags[0].ProductTag.priority).to.equal(1)
expect(products[0].tags[1].productTag.priority).to.equal(2) expect(products[0].Tags[1].ProductTag.priority).to.equal(2)
expect(products[1].tags[0].productTag.priority).to.equal(1) expect(products[1].Tags[0].ProductTag.priority).to.equal(1)
expect(products[2].tags[0].productTag.priority).to.equal(3) expect(products[2].Tags[0].ProductTag.priority).to.equal(3)
expect(products[2].tags[1].productTag.priority).to.equal(1) expect(products[2].Tags[1].ProductTag.priority).to.equal(1)
expect(products[2].tags[2].productTag.priority).to.equal(2) expect(products[2].Tags[2].ProductTag.priority).to.equal(2)
done() done()
}) })
...@@ -832,7 +832,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -832,7 +832,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].group).to.be.ok expect(users[0].Group).to.be.ok
done() done()
}) })
}) })
...@@ -878,8 +878,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -878,8 +878,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].group).to.be.ok expect(users[0].Group).to.be.ok
expect(users[0].group.name).to.equal('A') expect(users[0].Group.name).to.equal('A')
done() done()
}) })
}) })
...@@ -925,7 +925,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -925,7 +925,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
}) })
done() done()
}) })
...@@ -966,8 +966,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -966,8 +966,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
] ]
}).done(function (err, john) { }).done(function (err, john) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(john.address).to.be.ok expect(john.Address).to.be.ok
expect(john.address.street).to.be.ok expect(john.Address.Street).to.be.ok
done(); done();
}) })
...@@ -1039,8 +1039,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1039,8 +1039,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
expect(user.group.categories).to.be.ok expect(user.Group.Categories).to.be.ok
}) })
done() done()
}) })
...@@ -1109,8 +1109,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1109,8 +1109,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.team).to.be.ok expect(user.Team).to.be.ok
expect(user.team.tags).to.be.ok expect(user.Team.Tags).to.be.ok
}) })
done() done()
}) })
...@@ -1179,8 +1179,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1179,8 +1179,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
expect(user.group.categories).to.be.ok expect(user.Group.Categories).to.be.ok
}) })
done() done()
}) })
...@@ -1227,8 +1227,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1227,8 +1227,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].leaderOf).to.be.ok expect(users[0].LeaderOf).to.be.ok
expect(users[0].leaderOf.title).to.equal('Beta') expect(users[0].LeaderOf.title).to.equal('Beta')
done() done()
}) })
}) })
...@@ -1294,7 +1294,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1294,7 +1294,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(products.length).to.equal(1) expect(products.length).to.equal(1)
expect(products[0].tags.length).to.equal(1) expect(products[0].Tags.length).to.equal(1)
done() done()
}) })
...@@ -1468,10 +1468,10 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1468,10 +1468,10 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
expect(user.memberships.length).to.equal(1) expect(user.Memberships.length).to.equal(1)
expect(user.memberships[0].rank.name).to.equal('Admin') expect(user.Memberships[0].Rank.name).to.equal('Admin')
expect(user.products.length).to.equal(1) expect(user.Products.length).to.equal(1)
expect(user.products[0].prices.length).to.equal(1) expect(user.Products[0].Prices.length).to.equal(1)
}) })
done() done()
...@@ -1527,7 +1527,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1527,7 +1527,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(users.length).to.equal(2) expect(users.length).to.equal(2)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group.name).to.equal('A') expect(user.Group.name).to.equal('A')
}) })
done() done()
}) })
...@@ -1554,9 +1554,9 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1554,9 +1554,9 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(products.length).to.equal(3) expect(products.length).to.equal(3)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.company.name).to.equal('NYSE') expect(product.Company.name).to.equal('NYSE')
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
}) })
done() done()
}) })
...@@ -1606,8 +1606,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1606,8 +1606,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
products.forEach(function (product) { products.forEach(function (product) {
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
product.tags.forEach(function (tag) { product.Tags.forEach(function (tag) {
expect(tag.get().productTags).not.to.be.ok expect(tag.get().productTags).not.to.be.ok
}) })
}) })
...@@ -1687,7 +1687,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1687,7 +1687,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(members.length).to.equal(20); expect(members.length).to.equal(20);
members.forEach(function (member) { members.forEach(function (member) {
expect(member.get('id')).not.to.be.ok; expect(member.get('id')).not.to.be.ok;
expect(member.albums.length).to.equal(1); expect(member.Albums.length).to.equal(1);
}); });
done(); done();
...@@ -1718,10 +1718,10 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1718,10 +1718,10 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(products.length).to.equal(6) expect(products.length).to.equal(6)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
product.prices.forEach(function (price) { product.Prices.forEach(function (price) {
expect(price.value).to.be.above(5) expect(price.value).to.be.above(5)
}) })
}) })
...@@ -1748,10 +1748,10 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1748,10 +1748,10 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(products.length).to.equal(10) expect(products.length).to.equal(10)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
product.tags.forEach(function (tag) { product.Tags.forEach(function (tag) {
expect(['A', 'B', 'C']).to.include(tag.name) expect(['A', 'B', 'C']).to.include(tag.name)
}) })
}) })
...@@ -1794,8 +1794,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1794,8 +1794,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
it("should still pull the main record(s) when an included model is not required and has where restrictions without matches", function () { it("should still pull the main record(s) when an included model is not required and has where restrictions without matches", function () {
var self = this var self = this
, A = this.sequelize.define( 'A', {name: DataTypes.STRING(40)} ) , A = this.sequelize.define( 'a', {name: DataTypes.STRING(40)} )
, B = this.sequelize.define( 'B', {name: DataTypes.STRING(40)} ); , B = this.sequelize.define( 'b', {name: DataTypes.STRING(40)} );
A.hasMany(B); A.hasMany(B);
B.hasMany(A); B.hasMany(A);
......
...@@ -403,24 +403,24 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -403,24 +403,24 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
expect(user.memberships).to.be.ok expect(user.Memberships).to.be.ok
user.memberships.sort(sortById) user.Memberships.sort(sortById)
expect(user.memberships.length).to.equal(2) expect(user.Memberships.length).to.equal(2)
expect(user.memberships[0].group.name).to.equal('Developers') expect(user.Memberships[0].Group.name).to.equal('Developers')
expect(user.memberships[0].rank.canRemove).to.equal(1) expect(user.Memberships[0].Rank.canRemove).to.equal(1)
expect(user.memberships[1].group.name).to.equal('Designers') expect(user.Memberships[1].Group.name).to.equal('Designers')
expect(user.memberships[1].rank.canRemove).to.equal(0) expect(user.Memberships[1].Rank.canRemove).to.equal(0)
user.products.sort(sortById) user.Products.sort(sortById)
expect(user.products.length).to.equal(2) expect(user.Products.length).to.equal(2)
expect(user.products[0].tags.length).to.equal(2) expect(user.Products[0].Tags.length).to.equal(2)
expect(user.products[1].tags.length).to.equal(1) expect(user.Products[1].Tags.length).to.equal(1)
expect(user.products[0].category).to.be.ok expect(user.Products[0].Category).to.be.ok
expect(user.products[1].category).not.to.be.ok expect(user.Products[1].Category).not.to.be.ok
expect(user.products[0].prices.length).to.equal(2) expect(user.Products[0].Prices.length).to.equal(2)
expect(user.products[1].prices.length).to.equal(4) expect(user.Products[1].Prices.length).to.equal(4)
done() done()
}) })
...@@ -435,14 +435,14 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -435,14 +435,14 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}) })
it('should support many levels of belongsTo', function (done) { it('should support many levels of belongsTo', function (done) {
var A = this.sequelize.define('A', {}, {schema: "account"}) var A = this.sequelize.define('a', {}, {schema: "account"})
, B = this.sequelize.define('B', {}, {schema: "account"}) , B = this.sequelize.define('b', {}, {schema: "account"})
, C = this.sequelize.define('C', {}, {schema: "account"}) , C = this.sequelize.define('c', {}, {schema: "account"})
, D = this.sequelize.define('D', {}, {schema: "account"}) , D = this.sequelize.define('d', {}, {schema: "account"})
, E = this.sequelize.define('E', {}, {schema: "account"}) , E = this.sequelize.define('e', {}, {schema: "account"})
, F = this.sequelize.define('F', {}, {schema: "account"}) , F = this.sequelize.define('f', {}, {schema: "account"})
, G = this.sequelize.define('G', {}, {schema: "account"}) , G = this.sequelize.define('g', {}, {schema: "account"})
, H = this.sequelize.define('H', {}, {schema: "account"}) , H = this.sequelize.define('h', {}, {schema: "account"})
A.belongsTo(B) A.belongsTo(B)
B.belongsTo(C) B.belongsTo(C)
...@@ -484,7 +484,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -484,7 +484,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
async.eachSeries(singles, function (model, callback) { async.eachSeries(singles, function (model, callback) {
model.create({}).done(function (err, instance) { model.create({}).done(function (err, instance) {
if (previousInstance) { if (previousInstance) {
previousInstance["set"+model.name](instance).done(function () { previousInstance["set"+Sequelize.Utils.uppercaseFirst(model.name)](instance).done(function () {
previousInstance = instance previousInstance = instance
callback() callback()
}) })
...@@ -615,8 +615,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -615,8 +615,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(as[0].itemA.test).to.eql('abc') expect(as[0].itemA.test).to.eql('abc')
expect(as[1].itemA.test).to.eql('abc') expect(as[1].itemA.test).to.eql('abc')
expect(as[0].order.position).to.eql(1) expect(as[0].Order.position).to.eql(1)
expect(as[1].order.position).to.eql(2) expect(as[1].Order.position).to.eql(2)
done() done()
}) })
...@@ -686,14 +686,14 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -686,14 +686,14 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, products) { }).done(function (err, products) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(products[0].tags[0].productTag.priority).to.equal(1) expect(products[0].Tags[0].ProductTag.priority).to.equal(1)
expect(products[0].tags[1].productTag.priority).to.equal(2) expect(products[0].Tags[1].ProductTag.priority).to.equal(2)
expect(products[1].tags[0].productTag.priority).to.equal(1) expect(products[1].Tags[0].ProductTag.priority).to.equal(1)
expect(products[2].tags[0].productTag.priority).to.equal(3) expect(products[2].Tags[0].ProductTag.priority).to.equal(3)
expect(products[2].tags[1].productTag.priority).to.equal(1) expect(products[2].Tags[1].ProductTag.priority).to.equal(1)
expect(products[2].tags[2].productTag.priority).to.equal(2) expect(products[2].Tags[2].ProductTag.priority).to.equal(2)
done() done()
}) })
...@@ -732,7 +732,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -732,7 +732,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].group).to.be.ok expect(users[0].Group).to.be.ok
done() done()
}) })
}) })
...@@ -778,8 +778,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -778,8 +778,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].group).to.be.ok expect(users[0].Group).to.be.ok
expect(users[0].group.name).to.equal('A') expect(users[0].Group.name).to.equal('A')
done() done()
}) })
}) })
...@@ -825,7 +825,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -825,7 +825,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
}) })
done() done()
}) })
...@@ -893,8 +893,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -893,8 +893,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
expect(user.group.categories).to.be.ok expect(user.Group.Categories).to.be.ok
}) })
done() done()
}) })
...@@ -963,8 +963,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -963,8 +963,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.team).to.be.ok expect(user.Team).to.be.ok
expect(user.team.tags).to.be.ok expect(user.Team.Tags).to.be.ok
}) })
done() done()
}) })
...@@ -1033,8 +1033,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1033,8 +1033,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group).to.be.ok expect(user.Group).to.be.ok
expect(user.group.categories).to.be.ok expect(user.Group.Categories).to.be.ok
}) })
done() done()
}) })
...@@ -1081,8 +1081,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1081,8 +1081,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
}).done(function (err, users) { }).done(function (err, users) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].leaderOf).to.be.ok expect(users[0].LeaderOf).to.be.ok
expect(users[0].leaderOf.title).to.equal('Beta') expect(users[0].LeaderOf.title).to.equal('Beta')
done() done()
}) })
}) })
...@@ -1148,7 +1148,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1148,7 +1148,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(products.length).to.equal(1) expect(products.length).to.equal(1)
expect(products[0].tags.length).to.equal(1) expect(products[0].Tags.length).to.equal(1)
done() done()
}) })
...@@ -1322,10 +1322,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1322,10 +1322,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(err).not.to.be.ok expect(err).not.to.be.ok
users.forEach(function (user) { users.forEach(function (user) {
expect(user.memberships.length).to.equal(1) expect(user.Memberships.length).to.equal(1)
expect(user.memberships[0].rank.name).to.equal('Admin') expect(user.Memberships[0].Rank.name).to.equal('Admin')
expect(user.products.length).to.equal(1) expect(user.Products.length).to.equal(1)
expect(user.products[0].prices.length).to.equal(1) expect(user.Products[0].Prices.length).to.equal(1)
}) })
done() done()
...@@ -1381,7 +1381,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1381,7 +1381,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(users.length).to.equal(2) expect(users.length).to.equal(2)
users.forEach(function (user) { users.forEach(function (user) {
expect(user.group.name).to.equal('A') expect(user.Group.name).to.equal('A')
}) })
done() done()
}) })
...@@ -1408,9 +1408,9 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1408,9 +1408,9 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(products.length).to.equal(3) expect(products.length).to.equal(3)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.company.name).to.equal('NYSE') expect(product.Company.name).to.equal('NYSE')
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
}) })
done() done()
}) })
...@@ -1437,10 +1437,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1437,10 +1437,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(products.length).to.equal(6) expect(products.length).to.equal(6)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
product.prices.forEach(function (price) { product.Prices.forEach(function (price) {
expect(price.value).to.be.above(5) expect(price.value).to.be.above(5)
}) })
}) })
...@@ -1467,10 +1467,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () { ...@@ -1467,10 +1467,10 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
expect(products.length).to.equal(10) expect(products.length).to.equal(10)
products.forEach(function (product) { products.forEach(function (product) {
expect(product.tags.length).to.be.ok expect(product.Tags.length).to.be.ok
expect(product.prices.length).to.be.ok expect(product.Prices.length).to.be.ok
product.tags.forEach(function (tag) { product.Tags.forEach(function (tag) {
expect(['A', 'B', 'C']).to.include(tag.name) expect(['A', 'B', 'C']).to.include(tag.name)
}) })
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!