From 19c2ae415fd1ee2c8e3040a75c361e4898685df8 Mon Sep 17 00:00:00 2001 From: NotGonnaGitUs Date: Mon, 4 May 2015 15:35:45 +0530 Subject: [PATCH] Trying out new test to check user balance after creating a challenge with prize. --- test/api.mocha.coffee | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/api.mocha.coffee b/test/api.mocha.coffee index 5b54e6052c..e88bd347ca 100644 --- a/test/api.mocha.coffee +++ b/test/api.mocha.coffee @@ -479,6 +479,32 @@ describe "API", -> cb() ], done + it "Creates a challenge with prize", (done) -> + (cb) -> + User.findByIdAndUpdate _id, + $set: + "balance": 8 + , cb + request.post(baseURL + "/challenges").send( + group: group._id + prize: 10 + official: true + ).end (res) -> + expectCode res, 200 + async.parallel [ + (cb) -> + User.findById _id, cb + (cb) -> + Challenge.findById res.body._id, cb + ], (err, results) -> + _user = results[0] + challenge = results[1] + expect(_user.balance).to.be 5.5 + done() + + ###* + QUESTS + ### describe "Quests", -> party = undefined participating = []