Skip to content

Commit 7c124aa

Browse files
committed
Changes Model.extendsTo to avoid using Model.get(num)
Uses Model.find().first() since there's only one item in Model and this way mongodb works directly
1 parent a05c559 commit 7c124aa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/integration/association-extend.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("Model.extendsTo()", function() {
4848
before(setup());
4949

5050
it("should return true if found", function (done) {
51-
Person.get(1, function (err, John) {
51+
Person.find().first(function (err, John) {
5252
should.equal(err, null);
5353

5454
John.hasAddress(function (err, hasAddress) {
@@ -61,7 +61,7 @@ describe("Model.extendsTo()", function() {
6161
});
6262

6363
it("should return false if not found", function (done) {
64-
Person.get(1, function (err, John) {
64+
Person.find().first(function (err, John) {
6565
should.equal(err, null);
6666

6767
John.removeAddress(function () {
@@ -92,7 +92,7 @@ describe("Model.extendsTo()", function() {
9292
before(setup());
9393

9494
it("should return extension if found", function (done) {
95-
Person.get(1, function (err, John) {
95+
Person.find().first(function (err, John) {
9696
should.equal(err, null);
9797

9898
John.getAddress(function (err, Address) {
@@ -106,7 +106,7 @@ describe("Model.extendsTo()", function() {
106106
});
107107

108108
it("should return error if not found", function (done) {
109-
Person.get(1, function (err, John) {
109+
Person.find().first(function (err, John) {
110110
should.equal(err, null);
111111

112112
John.removeAddress(function () {
@@ -137,7 +137,7 @@ describe("Model.extendsTo()", function() {
137137
before(setup());
138138

139139
it("should remove any previous extension", function (done) {
140-
Person.get(1, function (err, John) {
140+
Person.find().first(function (err, John) {
141141
should.equal(err, null);
142142

143143
PersonAddress.find({ number: 123 }).count(function (err, c) {
@@ -174,7 +174,7 @@ describe("Model.extendsTo()", function() {
174174
before(setup());
175175

176176
it("should remove any extension", function (done) {
177-
Person.get(1, function (err, John) {
177+
Person.find().first(function (err, John) {
178178
should.equal(err, null);
179179

180180
PersonAddress.find({ number: 123 }).count(function (err, c) {

0 commit comments

Comments
 (0)