mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Improve travis success rate
https://travis-ci.org/codecombat/codecombat/builds/96076589 Failures: 1) Recalculate Achievements remove earned achievements Message: Expected 1 to be 0. Stack: Error: Expected 1 to be 0. ... Apparently EarnedAchievement creation from previous tests bleeds into this test case. Adding a timeout to minimize the race condition problem here.
This commit is contained in:
parent
079109145f
commit
def3e9a009
1 changed files with 10 additions and 8 deletions
|
@ -220,14 +220,16 @@ describe 'Recalculate Achievements', ->
|
|||
EarnedAchievementHandler = require '../../../server/achievements/earned_achievement_handler'
|
||||
|
||||
it 'remove earned achievements', (done) ->
|
||||
clearModels [EarnedAchievement], (err) ->
|
||||
expect(err).toBeNull()
|
||||
EarnedAchievement.find {}, (err, earned) ->
|
||||
expect(earned.length).toBe 0
|
||||
|
||||
User.update {}, {$set: {points: 0}}, {multi:true}, (err) ->
|
||||
expect(err).toBeNull()
|
||||
done()
|
||||
f = ->
|
||||
clearModels [EarnedAchievement], (err) ->
|
||||
expect(err).toBeNull()
|
||||
EarnedAchievement.find {}, (err, earned) ->
|
||||
expect(earned.length).toBe 0
|
||||
|
||||
User.update {}, {$set: {points: 0}}, {multi:true}, (err) ->
|
||||
expect(err).toBeNull()
|
||||
done()
|
||||
setTimeout f, 100 # wait for previous tests to wrap up to avoid race condition
|
||||
|
||||
it 'can not be accessed by regular users', (done) ->
|
||||
loginJoe -> request.post {uri:getURL '/admin/earned_achievement/recalculate'}, (err, res, body) ->
|
||||
|
|
Loading…
Reference in a new issue