Fix tests

This commit is contained in:
Fabien Franzen 2014-08-22 17:05:11 +02:00
parent 6827b715bc
commit b5b0ecd319
1 changed files with 18 additions and 18 deletions

View File

@ -495,7 +495,7 @@ describe('relations - integration', function () {
describe('embedsOne', function() {
before(function defineGroupAndImageModels() {
before(function defineGroupAndPosterModels() {
var group = app.model(
'group',
{ properties: { name: 'string' },
@ -503,20 +503,20 @@ describe('relations - integration', function () {
plural: 'groups'
}
);
var image = app.model(
'image',
var poster = app.model(
'poster',
{ properties: { url: 'string' }, dataSource: 'db' }
);
group.embedsOne(image, { as: 'cover' });
group.embedsOne(poster, { as: 'cover' });
});
before(function createImage(done) {
var test = this;
app.models.group.create({ name: 'Group 1' },
function(err, list) {
function(err, group) {
if (err) return done(err);
test.group = group;
group.image.build({ url: 'http://image.url' });
group.cover.build({ url: 'http://image.url' });
group.save(done);
});
});
@ -531,9 +531,9 @@ describe('relations - integration', function () {
this.get(url)
.expect(200, function(err, res) {
expect(res.body.name).to.be.equal('Group 1');
expect(res.body.imageItem).to.be.eql([
expect(res.body.poster).to.be.eql(
{ url: 'http://image.url' }
]);
);
done();
});
});
@ -543,9 +543,9 @@ describe('relations - integration', function () {
this.get(url)
.expect(200, function(err, res) {
expect(res.body).to.be.eql([
{ url: 'http://image.url' },
]);
expect(res.body).to.be.eql(
{ url: 'http://image.url' }
);
done();
});
});
@ -1018,7 +1018,7 @@ describe('relations - integration', function () {
describe('nested relations', function() {
before(function defineProductAndCategoryModels() {
before(function defineModels() {
var Book = app.model(
'Book',
{ properties: { name: 'string' }, dataSource: 'db',