Fixed the rest of the server tests.

This commit is contained in:
Scott Erickson 2014-08-29 16:28:07 -07:00
parent 0ba9db6c14
commit b4d9a787f0
5 changed files with 9 additions and 13 deletions

View file

@ -73,7 +73,7 @@ _.extend AchievementSchema.properties,
kind: {enum: ['linear', 'logarithmic', 'quadratic'] }
parameters:
type: 'object'
default: { a: 1, b: 1, c: 1 }
default: { a: 1, b: 0, c: 0 }
properties:
a: {type: 'number' }
b: {type: 'number' }

View file

@ -117,7 +117,7 @@ describe '/db/article', ->
request.get {uri: url + '?project=true', json: {}}, (err, res, body) ->
expect(res.statusCode).toBe(200)
expect(body.length).toBe(2)
expect(body[0].created).toBeUndefined()
expect(body[0].body).toBeUndefined()
expect(body[0].version).toBeDefined()
# custom projection

View file

@ -65,11 +65,9 @@ describe 'LevelComponent', ->
expect(body.code).toBe(components[0].code)
expect(body.codeLanguage).toBe(components[0].codeLanguage)
expect(body.__v).toBe(0)
expect(body.official).toBeDefined()
expect(body.creator).toBeDefined()
expect(body.original).toBeDefined()
expect(body.created).toBeDefined()
expect(body.configSchema).toBeDefined()
expect(body.dependencies).toBeDefined()
expect(body.propertyDocumentation).toBeDefined()
expect(body.version.isLatestMajor).toBe(true)
@ -83,7 +81,7 @@ describe 'LevelComponent', ->
expect(res.statusCode).toBe(200)
body = JSON.parse(body)
expect(body._id).toBe(components[0]._id)
expect(body.official).toBe(false)
expect(body.official).toBeUndefined()
done()
it 'has system ai by default', (done) ->
@ -100,7 +98,7 @@ describe 'LevelComponent', ->
loginJoe ->
request.post {uri: url, json: components[0]}, (err, res, body) ->
expect(res.statusCode).toBe(200)
expect(body.official).toBe(false)
expect(body.official).toBeUndefined()
done()
it 'official property is editable by an admin.', (done) ->
@ -118,7 +116,7 @@ describe 'LevelComponent', ->
expect(res.statusCode).toBe(200)
body = JSON.parse(body)
expect(body._id).toBe(components[0]._id)
expect(body.official).toBe(false)
expect(body.official).toBeUndefined()
expect(body.version.isLatestMinor).toBe(false)
expect(body.version.isLatestMajor).toBe(false)
done()

View file

@ -73,11 +73,9 @@ describe 'LevelSystem', ->
expect(body.code).toBe(systems[0].code)
expect(body.codeLanguage).toBe(systems[0].codeLanguage)
expect(body.__v).toBe(0)
expect(body.official).toBeDefined()
expect(body.creator).toBeDefined()
expect(body.original).toBeDefined()
expect(body.created).toBeDefined()
expect(body.configSchema).toBeDefined()
expect(body.dependencies).toBeDefined()
expect(body.propertyDocumentation).toBeDefined()
expect(body.version.isLatestMajor).toBe(true)
@ -91,7 +89,7 @@ describe 'LevelSystem', ->
expect(res.statusCode).toBe(200)
body = JSON.parse(body)
expect(body._id).toBe(systems[0]._id)
expect(body.official).toBe(false)
expect(body.official).toBeUndefined()
done()
it 'official property isn\'t editable by an ordinary user.', (done) ->
@ -116,7 +114,7 @@ describe 'LevelSystem', ->
expect(res.statusCode).toBe(200)
body = JSON.parse(body)
expect(body._id).toBe(systems[0]._id)
expect(body.official).toBe(false)
expect(body.official).toBeUndefined()
expect(body.version.isLatestMinor).toBe(false)
expect(body.version.isLatestMajor).toBe(false)
done()

View file

@ -71,13 +71,13 @@ describe '/db/patch', ->
it 'does not add duplicate watchers', (done) ->
watchingURL = getURL("/db/article/#{articles[0]._id}/watch")
request.put {uri: watchingURL, json: {on: true}}, (err, res, body) ->
expect(body.watchers.length).toBe(2)
expect(body.watchers.length).toBe(4)
done()
it 'allows removing yourself', (done) ->
watchingURL = getURL("/db/article/#{articles[0]._id}/watch")
request.put {uri: watchingURL, json: {on: false}}, (err, res, body) ->
expect(body.watchers.length).toBe(1)
expect(body.watchers.length).toBe(3)
done()
it 'allows the submitter to withdraw the pull request', (done) ->