Add POST /db/level/:handle test

It's erroring in my dev console, complaining of duplicate keys, and not sure why.
Adding a test to make sure creating a new level version doesn't break.
This commit is contained in:
Scott Erickson 2016-05-26 14:46:48 -07:00
parent feeca7a586
commit b255b02854

View file

@ -39,6 +39,21 @@ describe 'Level', ->
body = JSON.parse(body)
expect(body.type).toBeDefined()
done()
describe 'POST /db/level/:handle', ->
it 'creates a new version', utils.wrap (done) ->
yield utils.clearModels([Campaign, Course, CourseInstance, Level, User])
admin = yield utils.initAdmin()
yield utils.loginUser(admin)
@level = yield utils.makeLevel()
levelJSON = @level.toObject()
levelJSON.name = 'New name'
url = getURL("/db/level/#{@level.id}")
[res, body] = yield request.postAsync({url: url, json: levelJSON})
expect(res.statusCode).toBe(200)
done()
describe 'GET /db/level/:handle/session', ->