🐛Remove duplicate test utils.makeLevelSession

This commit is contained in:
Matt Lott 2016-09-12 10:54:03 -07:00
parent 71a63709e7
commit 9ccca9a5a3
2 changed files with 35 additions and 50 deletions

View file

@ -499,13 +499,11 @@ describe 'GET /db/classroom/:handle/member-sessions', ->
@courseA = yield utils.makeCourse({free: true, releasePhase: 'released'}, {campaign: @campaignA})
@courseB = yield utils.makeCourse({free: true, releasePhase: 'released'}, {campaign: @campaignB})
@student1 = yield utils.initUser({role: 'student'})
yield utils.loginUser(@student1)
@session1A = yield utils.makeLevelSession({state: { complete: true }, level: {original: @levelA._id.toHexString()}})
@session1B = yield utils.makeLevelSession({state: { complete: false }, level: {original: @levelB._id.toHexString()}})
@student2 = yield utils.initUser({role: 'student'})
yield utils.loginUser(@student2)
@session2A = yield utils.makeLevelSession({state: { complete: true }, level: {original: @levelA._id.toHexString()}})
@session2B = yield utils.makeLevelSession({state: { complete: false }, level: {original: @levelB._id.toHexString()}})
@session1A = yield utils.makeLevelSession({state: { complete: true }}, {creator: @student1, level: @levelA})
@session1B = yield utils.makeLevelSession({state: { complete: false }}, {creator: @student1, level: @levelB})
@session2A = yield utils.makeLevelSession({state: { complete: true }}, {creator: @student2, level: @levelA})
@session2B = yield utils.makeLevelSession({state: { complete: false }}, {creator: @student2, level: @levelB})
yield utils.loginUser(@teacher)
@classroom = yield utils.makeClassroom({}, { members: [@student1, @student2] })
@courseInstanceA = yield utils.makeCourseInstance({courseID: @courseA.id, classroomID: @classroom.id}, { members: [@student1, @student2] })

View file

@ -209,19 +209,6 @@ module.exports = mw =
expect(res.statusCode).toBe(200)
ThangType.findById(res.body._id).exec done
makeLevelSession: Promise.promisify (data, sources, done) ->
args = Array.from(arguments)
[done, [data, sources]] = [args.pop(), args]
data = _.extend({}, {
creator: mw.lastLogin.id
permissions: [{target: mw.lastLogin.id, access: 'owner'}]
}, data)
# TODO: using request.post strips the creator field for some reason
session = new LevelSession data
session.save done
makeAchievement: Promise.promisify (data, sources, done) ->
args = Array.from(arguments)
[done, [data, sources]] = [args.pop(), args]