mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-27 21:31:16 -04:00
add unit test
This commit is contained in:
parent
aa83f77fd6
commit
319a8d3941
2 changed files with 26 additions and 1 deletions
test/server
|
@ -33,7 +33,8 @@ describe '/file', ->
|
|||
expect(body.metadata).toBeUndefined()
|
||||
done()
|
||||
|
||||
request.post(options, func)
|
||||
loginJoe ->
|
||||
request.post(options, func)
|
||||
|
||||
it 'can\'t be created if invalid (property path is required)', (done) ->
|
||||
func = (err, res, body) ->
|
||||
|
|
24
test/server/unit/user.spec.coffee
Normal file
24
test/server/unit/user.spec.coffee
Normal file
|
@ -0,0 +1,24 @@
|
|||
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()
|
||||
|
Loading…
Add table
Reference in a new issue