mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
Updated test to see if it works
This commit is contained in:
parent
19c2ae415f
commit
8fae71d7ef
1 changed files with 17 additions and 15 deletions
|
|
@ -480,24 +480,26 @@ describe "API", ->
|
||||||
], done
|
], done
|
||||||
|
|
||||||
it "Creates a challenge with prize", (done) ->
|
it "Creates a challenge with prize", (done) ->
|
||||||
(cb) ->
|
|
||||||
User.findByIdAndUpdate _id,
|
User.findByIdAndUpdate _id,
|
||||||
$set:
|
$set:
|
||||||
"balance": 8
|
"balance": 8
|
||||||
, cb
|
, (err, _user) ->
|
||||||
request.post(baseURL + "/challenges").send(
|
expect(err).to.not.be.ok()
|
||||||
group: group._id
|
|
||||||
prize: 10
|
|
||||||
official: true
|
|
||||||
).end (res) ->
|
|
||||||
expectCode res, 200
|
|
||||||
async.parallel [
|
async.parallel [
|
||||||
(cb) ->
|
(cb) ->
|
||||||
User.findById _id, cb
|
request.post(baseURL + "/challenges").send(
|
||||||
|
group: group._id
|
||||||
|
dailys: []
|
||||||
|
todos: []
|
||||||
|
rewards: []
|
||||||
|
habits: []
|
||||||
|
prize: 10
|
||||||
|
).end (res) ->
|
||||||
|
expect(res.body.prize).to.be 10
|
||||||
|
cb()
|
||||||
(cb) ->
|
(cb) ->
|
||||||
Challenge.findById res.body._id, cb
|
Challenge.findById group._id, cb
|
||||||
], (err, results) ->
|
], (err, result) ->
|
||||||
_user = results[0]
|
|
||||||
challenge = results[1]
|
challenge = results[1]
|
||||||
expect(_user.balance).to.be 5.5
|
expect(_user.balance).to.be 5.5
|
||||||
done()
|
done()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue