From 699bc7aa974c4a46cd8b6d2da71d5088ad532fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 7 Apr 2015 13:43:26 +0200 Subject: [PATCH] test: remove global autoAttach --- test/model.test.js | 2 ++ test/rest.middleware.test.js | 1 + test/support.js | 3 --- test/user.test.js | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/model.test.js b/test/model.test.js index 29e0fef8..7b037adb 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -501,9 +501,11 @@ describe.onServer('Remote Methods', function() { describe('Model._getACLModel()', function() { it('should return the subclass of ACL', function() { var Model = require('../').Model; + var originalValue = Model._ACL(); var acl = ACL.extend('acl'); Model._ACL(null); // Reset the ACL class for the base model var model = Model._ACL(); + Model._ACL(originalValue); // Reset the value back assert.equal(model, acl); }); }); diff --git a/test/rest.middleware.test.js b/test/rest.middleware.test.js index e608c5b2..8168a491 100644 --- a/test/rest.middleware.test.js +++ b/test/rest.middleware.test.js @@ -3,6 +3,7 @@ describe('loopback.rest', function() { beforeEach(function() { var ds = app.dataSource('db', { connector: loopback.Memory }); MyModel = ds.createModel('MyModel', {name: String}); + loopback.autoAttach(); }); it('works out-of-the-box', function(done) { diff --git a/test/support.js b/test/support.js index 1ef0eefc..0f925a38 100644 --- a/test/support.js +++ b/test/support.js @@ -30,9 +30,6 @@ beforeEach(function() { {type: 'STUB'} ] }); - - // auto attach data sources to models - loopback.autoAttach(); }); assertValidDataSource = function(dataSource) { diff --git a/test/user.test.js b/test/user.test.js index 56aae9e9..682b2f46 100644 --- a/test/user.test.js +++ b/test/user.test.js @@ -23,6 +23,7 @@ describe('User', function() { // Update the AccessToken relation to use the subclass of User AccessToken.belongsTo(User); + User.hasMany(AccessToken); // allow many User.afterRemote's to be called User.setMaxListeners(0); @@ -1071,6 +1072,7 @@ describe('User', function() { assert.equal(info.accessToken.ttl / 60, 15); assert(calledBack); info.accessToken.user(function(err, user) { + if (err) return done(err); assert.equal(user.email, email); done(); });