Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #863 from mleanos/hotfix/user-model-tests-roles
Browse files Browse the repository at this point in the history
[hotfix] Fixed User model tests
  • Loading branch information
lirantal committed Aug 31, 2015
2 parents 8335aa7 + 14b8dd4 commit 16b481f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions modules/users/tests/server/user.server.model.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ describe('User Model Unit Tests:', function () {
});

it('should be able to update an existing user with valid roles without problems', function (done) {
var _user = new User(user);
var _user1 = new User(user1);

_user.save(function (err) {
_user1.save(function (err) {
should.not.exist(err);
_user.roles = ['user', 'admin'];
_user.save(function (err) {
_user1.roles = ['user', 'admin'];
_user1.save(function (err) {
should.not.exist(err);
_user.remove(function (err) {
_user1.remove(function (err) {
should.not.exist(err);
done();
});
Expand All @@ -102,14 +102,14 @@ describe('User Model Unit Tests:', function () {
});

it('should be able to show an error when trying to update an existing user without a role', function (done) {
var _user = new User(user);
var _user1 = new User(user1);

_user.save(function (err) {
_user1.save(function (err) {
should.not.exist(err);
_user.roles = [];
_user.save(function (err) {
_user1.roles = [];
_user1.save(function (err) {
should.exist(err);
_user.remove(function (err) {
_user1.remove(function (err) {
should.not.exist(err);
done();
});
Expand All @@ -118,14 +118,14 @@ describe('User Model Unit Tests:', function () {
});

it('should be able to show an error when trying to update an existing user with a invalid role', function (done) {
var _user = new User(user);
var _user1 = new User(user1);

_user.save(function (err) {
_user1.save(function (err) {
should.not.exist(err);
_user.roles = ['invalid-user-role-enum'];
_user.save(function (err) {
_user1.roles = ['invalid-user-role-enum'];
_user1.save(function (err) {
should.exist(err);
_user.remove(function (err) {
_user1.remove(function (err) {
should.not.exist(err);
done();
});
Expand Down

0 comments on commit 16b481f

Please sign in to comment.