codecombat/test/server/unit/user.spec.coffee
Sébastien Moratinos 319a8d3941 add unit test
2014-02-04 08:36:25 +01:00

24 lines
658 B
CoffeeScript

GLOBAL._ = require('lodash')
User = require '../../../server/users/User'
describe 'user', ->
it 'is Admin if it has admin permission', (done) ->
adminUser = new User()
adminUser.set('permissions', ['whatever', 'admin', 'user'])
expect(adminUser.isAdmin()).toBeTruthy()
done()
it 'isn\'t Admin if it has no permission', (done) ->
myUser = new User()
myUser.set('permissions', [])
expect(myUser.isAdmin()).toBeFalsy()
done()
it 'isn\'t Admin if it has only user permission', (done) ->
classicUser = new User()
classicUser.set('permissions', ['user'])
expect(classicUser.isAdmin()).toBeFalsy()
done()