mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Fixed a couple server tests.
This commit is contained in:
parent
d1d6a734b4
commit
56e62bb4c8
2 changed files with 12 additions and 10 deletions
|
@ -50,15 +50,6 @@ describe 'Achievement', ->
|
||||||
expect(res.statusCode).toBe(403)
|
expect(res.statusCode).toBe(403)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
it 'can\'t be updated by ordinary users', (done) ->
|
|
||||||
loginJoe ->
|
|
||||||
request.put {uri: url, json: unlockable}, (err, res, body) ->
|
|
||||||
expect(res.statusCode).toBe(403)
|
|
||||||
|
|
||||||
request {method: 'patch', uri: url, json: unlockable}, (err, res, body) ->
|
|
||||||
expect(res.statusCode).toBe(403)
|
|
||||||
done()
|
|
||||||
|
|
||||||
it 'can be created by admins', (done) ->
|
it 'can be created by admins', (done) ->
|
||||||
loginAdmin ->
|
loginAdmin ->
|
||||||
request.post {uri: url, json: unlockable}, (err, res, body) ->
|
request.post {uri: url, json: unlockable}, (err, res, body) ->
|
||||||
|
@ -77,6 +68,17 @@ describe 'Achievement', ->
|
||||||
expect(docs.length).toBe 3
|
expect(docs.length).toBe 3
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it 'can\'t be updated by ordinary users', (done) ->
|
||||||
|
loginJoe ->
|
||||||
|
unlockable3 = _.clone(unlockable)
|
||||||
|
unlockable3.description = 'alsdfkhasdkfhajksdhfjkasdhfj'
|
||||||
|
request.put {uri: url, json: unlockable3}, (err, res, body) ->
|
||||||
|
expect(res.statusCode).toBe(403)
|
||||||
|
|
||||||
|
request {method: 'patch', uri: url, json: unlockable}, (err, res, body) ->
|
||||||
|
expect(res.statusCode).toBe(403)
|
||||||
|
done()
|
||||||
|
|
||||||
it 'can get all for ordinary users', (done) ->
|
it 'can get all for ordinary users', (done) ->
|
||||||
loginJoe ->
|
loginJoe ->
|
||||||
request.get {uri: url, json: unlockable}, (err, res, body) ->
|
request.get {uri: url, json: unlockable}, (err, res, body) ->
|
||||||
|
|
|
@ -69,7 +69,7 @@ describe 'POST /db/user', ->
|
||||||
expect(user.get('password')).toBeUndefined()
|
expect(user.get('password')).toBeUndefined()
|
||||||
expect(user?.get('passwordHash')).not.toBeUndefined()
|
expect(user?.get('passwordHash')).not.toBeUndefined()
|
||||||
if user?.get('passwordHash')?
|
if user?.get('passwordHash')?
|
||||||
expect(user.get('passwordHash')[..5]).toBe('31dc3d')
|
expect(user.get('passwordHash')[..5]).toBe('948c7e')
|
||||||
expect(user.get('permissions').length).toBe(0)
|
expect(user.get('permissions').length).toBe(0)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue