mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Fixed server tests to exit when they are finished. jasmine-node will never exit unless all connections are closed.
This helped: https://github.com/mhevery/jasmine-node/issues/318#issuecomment-43914090
This commit is contained in:
parent
6d15b5e631
commit
ea06bb3d52
3 changed files with 15 additions and 12 deletions
|
@ -9,6 +9,10 @@ jasmine.getEnv().addReporter(new jasmine.SpecReporter({
|
|||
displaySuccessfulSpec: true,
|
||||
displayFailedSpec: true
|
||||
}))
|
||||
|
||||
rep = new jasmine.JsApiReporter()
|
||||
jasmine.getEnv().addReporter(rep)
|
||||
|
||||
GLOBAL._ = require('lodash')
|
||||
_.str = require('underscore.string')
|
||||
_.mixin(_.str.exports())
|
||||
|
@ -149,3 +153,13 @@ _drop = (done) ->
|
|||
chunks = mongoose.connection.db.collection('media.chunks')
|
||||
chunks.remove {}, ->
|
||||
done()
|
||||
|
||||
tickInterval = null
|
||||
tick = ->
|
||||
# When you want jasmine-node to exit after running the tests,
|
||||
# you have to close the connection first.
|
||||
if rep.finished
|
||||
mongoose.disconnect()
|
||||
clearTimeout tickInterval
|
||||
|
||||
tickInterval = setInterval tick, 1000
|
|
@ -6,9 +6,8 @@ urlLogin = getURL('/auth/login')
|
|||
urlReset = getURL('/auth/reset')
|
||||
|
||||
describe '/auth/whoami', ->
|
||||
http = require 'http'
|
||||
it 'returns 200', (done) ->
|
||||
http.get(getURL('/auth/whoami'), (response) ->
|
||||
request.get(getURL('/auth/whoami'), (err, response) ->
|
||||
expect(response).toBeDefined()
|
||||
expect(response.statusCode).toBe(200)
|
||||
done()
|
||||
|
|
|
@ -18,13 +18,3 @@ describe 'Level', ->
|
|||
level.save (err) ->
|
||||
throw err if err
|
||||
done()
|
||||
|
||||
it 'loads again after being saved', (done) ->
|
||||
url = getURL('/db/level/'+level._id)
|
||||
request.get url, (err, res, body) ->
|
||||
expect(res.statusCode).toBe(200)
|
||||
sameLevel = JSON.parse(body)
|
||||
expect(sameLevel.name).toEqual(level.get 'name')
|
||||
expect(sameLevel.description).toEqual(level.get 'description')
|
||||
expect(sameLevel.permissions).toEqual(simplePermissions)
|
||||
done()
|
||||
|
|
Loading…
Reference in a new issue