From 2bfd67ccaad3c86b8e98bc327e71800dfe4b0d4f Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Thu, 7 Dec 2017 10:10:35 -0600 Subject: [PATCH] fix(test): working test with 0 userId --- test/role.test.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/role.test.js b/test/role.test.js index 4415984d..229a4179 100644 --- a/test/role.test.js +++ b/test/role.test.js @@ -364,9 +364,18 @@ describe('role model', function() { }); }); - it('should be properly authenticated with 0 userId', function(done) { + it.only('should be properly authenticated with 0 userId', function(done) { var userData = {name: 'Raymond', email: 'x@y.com', password: 'foobar', id: 0}; - User.create(userData, function(err, user) { + var TestUser = app.registry.createModel({ + name: 'TestUser', + base: 'User', + // forceId is set to false so we can create a user with a known ID, + // in this case 0 - which used to fail the falsy checks. + forceId: false, + }); + app.model(TestUser, {dataSource: 'db'}); + + TestUser.create(userData, function(err, user) { if (err) return done(err); Role.create({name: 'userRole'}, function(err, role) { if (err) return done(err);