From a906c750eb980e4e92bac856d690a734ce67a13d Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 10 May 2015 22:13:53 -0500 Subject: [PATCH] Correct spy set up --- test/api/pushNotifications.coffee | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/api/pushNotifications.coffee b/test/api/pushNotifications.coffee index 83f7400cbf..b79187af13 100644 --- a/test/api/pushNotifications.coffee +++ b/test/api/pushNotifications.coffee @@ -25,7 +25,7 @@ describe "Push-Notifications", -> describe "Events that send push notifications", -> - pushSpy = sinon.spy() + pushSpy = { sendNotify: sinon.spy() } context "Challenges", -> @@ -44,32 +44,31 @@ describe "Push-Notifications", -> context "Gifts", -> recipient = null members = rewire("../../website/src/controllers/members") - members.__set__('pushNotify', pushSpy) members.sendMessage = -> true + members.__set__('pushNotify', pushSpy) before (done) -> registerNewUser (err, _user) -> recipient = _user user.balance = 4 + user.save = -> return true + recipient.save = -> return true members.__set__ 'fetchMember', (id) -> return (cb) -> cb(null, recipient) done() , false - it "sends a push notification when gifted gems", (done) -> - req = { + req = { params: { uuid: "uuid" }, - body: { + body: { type: 'gems', gems: { amount: 1 } - } + } } res = { locals: { user: user } } members.sendGift req, res - - expect(pushSpy.calledOnce).to.be.ok - + # @TODO Expectations done() it "sends a push notification when gifted a subscription"