mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-21 13:18:53 +00:00
Correct spy set up
This commit is contained in:
parent
d4a296870b
commit
a906c750eb
1 changed files with 8 additions and 9 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue