From 1934b1546f841416a9718a382c1195e0dd06e13b Mon Sep 17 00:00:00 2001 From: Anton Kovylin Date: Mon, 18 Sep 2017 15:02:50 +0300 Subject: [PATCH 1/3] Fixed failed mysql tests --- test/integration/association-hasone-reverse-async.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/association-hasone-reverse-async.js b/test/integration/association-hasone-reverse-async.js index 6d10d79b..c393855e 100644 --- a/test/integration/association-hasone-reverse-async.js +++ b/test/integration/association-hasone-reverse-async.js @@ -181,11 +181,11 @@ describe("hasOne Async", function () { return [John, Deco.setOwnersAsync(John)]; }) .spread(function (John, Deco) { - return [John, Person.findAsync({ pet: Deco })]; + return [John, Person.findAsync({ pet: Deco, id: John.id })]; }) .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); }); }); @@ -205,7 +205,7 @@ describe("hasOne Async", function () { return [John, pets, pets[0].setOwnersAsync(John)]; }) .spread(function (John, pets) { - return [John, Person.findAsync({ pet: pets })]; + return [John, Person.findAsync({ pet: pets, id: John.id })]; }) .spread(function (John, owners) { should.exist(owners[0]); From c4e886df85a6fc8cafa895fe21c11538d8f448cc Mon Sep 17 00:00:00 2001 From: Anton Kovylin Date: Mon, 18 Sep 2017 16:13:14 +0300 Subject: [PATCH 2/3] Fix hasone-zeroid-async test according to old test logic --- test/integration/association-hasone-zeroid-async.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/association-hasone-zeroid-async.js b/test/integration/association-hasone-zeroid-async.js index b872a99d..29f3777e 100644 --- a/test/integration/association-hasone-zeroid-async.js +++ b/test/integration/association-hasone-zeroid-async.js @@ -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"); }); }); }); From 9e3ea6223e827ba08d64d02a93ce4f670fc16b62 Mon Sep 17 00:00:00 2001 From: Anton Kovylin Date: Mon, 18 Sep 2017 17:25:24 +0300 Subject: [PATCH 3/3] Fixed tests according to sync tests logic --- .../association-hasone-reverse-async.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/integration/association-hasone-reverse-async.js b/test/integration/association-hasone-reverse-async.js index c393855e..a15bd675 100644 --- a/test/integration/association-hasone-reverse-async.js +++ b/test/integration/association-hasone-reverse-async.js @@ -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); }); }); @@ -178,10 +180,10 @@ 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, id: John.id })]; + return [John, Person.findAsync({ pet: Deco })]; }) .spread(function(John, owner){ should.exist(owner[0]); @@ -205,7 +207,7 @@ describe("hasOne Async", function () { return [John, pets, pets[0].setOwnersAsync(John)]; }) .spread(function (John, pets) { - return [John, Person.findAsync({ pet: pets, id: John.id })]; + return [John, Person.findAsync({ pet: pets })]; }) .spread(function (John, owners) { should.exist(owners[0]);