codecombat/test/server/unit/user.spec.coffee

24 lines
656 B
CoffeeScript
Raw Normal View History

2014-06-30 22:16:26 -04:00
GLOBAL._ = require 'lodash'
2014-02-03 16:43:03 -05:00
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()