Skip to content

Commit

Permalink
Merge pull request #19 from locomote/fix/lm-2855-fix-tests-for-all-dr…
Browse files Browse the repository at this point in the history
…ivers

Fixed failed mysql tests
  • Loading branch information
dxg authored Sep 19, 2017
2 parents e41e1b1 + 9e3ea62 commit e2da459
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
20 changes: 11 additions & 9 deletions test/integration/association-hasone-reverse-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,25 @@ describe("hasOne Async", function () {
it("should be able to find given an association id", function () {
return Person
.findAsync({ name: "John Doe" })
.then(function (John) {
.then(function (persons) {
var John = persons[0];
should.exist(John);
return [John, Pet.findAsync({ name: "Deco" })];
})
.spread(function (John, Deco) {
var Deco = Deco[0];
should.exist(Deco);
return [John[0], Deco[0], Deco[0].hasOwnersAsync()];
return [John, Deco, Deco.hasOwnersAsync()];
})
.spread(function (John, Deco, has_owner) {
has_owner.should.equal(false);
return [John, Deco.setOwnersAsync(John)];
return [John, Deco, Deco.setOwnersAsync(John)];
})
.spread(function (John) {
return [John, Person.findAsync({ pet_id: 1 })];
.spread(function (John, Deco) {
return [John, Person.findAsync({ pet_id: Deco[Pet.id] })];
})
.spread(function (John, owner) {
should.exist(owner[0]);
should.exist(owner);
should.equal(owner[0].name, John.name);
});
});
Expand All @@ -178,14 +180,14 @@ describe("hasOne Async", function () {
})
.spread(function (John, Deco, has_owner) {
has_owner.should.equal(false);
return [John, Deco.setOwnersAsync(John)];
return [John, Deco, Deco.setOwnersAsync(John)];
})
.spread(function (John, Deco) {
return [John, Person.findAsync({ pet: Deco })];
})
.spread(function(John, owner){
should.exist(owner[1]);
should.equal(owner[1].name, John.name);
should.exist(owner[0]);
should.equal(owner[0].name, John.name);
});
});

Expand Down
8 changes: 4 additions & 4 deletions test/integration/association-hasone-zeroid-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ describe("hasOne promise-based methods", function() {
return Pet
.findAsync({petName: "Snagglepuss"})
.then(function(pets) {
pets[0].petName.should.equal("Snagglepuss");
pets[0].should.have.property("id");
pets[0].id.should.equal(11);
var pet = pets[0];
pet.petName.should.equal("Snagglepuss");
pet.should.have.property("id");
pet.id.should.equal(11);

return Person.allAsync();
})
.then(function (people) {
should.equal(typeof people[0], 'object');
should.equal(Array.isArray(people), true);
people[0].should.have.property("firstName", "Stuey");
});
});
});
Expand Down

0 comments on commit e2da459

Please sign in to comment.