Add test for getting push notification when gifted a subscription

This commit is contained in:
Blade Barringer
2015-05-13 19:31:26 -05:00
parent 3cbd5fd9ff
commit 023458b6e5
2 changed files with 41 additions and 2 deletions
+38 -1
View File
@@ -139,4 +139,41 @@ describe "Push-Notifications", ->
context "sending a subscription as a purchased gift", ->
it "sends a push notification"
it "sends a push notification", (done) ->
data = {
user: user,
gift: {
member: recipient
subscription: { key: 'basic_6mo' }
}
}
payments.createSubscription data
setTimeout -> # Allow createSubscription to finish
expect(pushSpy.sendNotify).to.have.been.calledOnce
expect(pushSpy.sendNotify).to.have.been.calledWith(
recipient,
'Gifted Subscription',
'6 months - by ' + user.profile.name
)
done()
, 100
it "does not send a push notification if buying subscription for self", (done) ->
data = {
user: user,
gift: {
member: user
subscription: { key: 'basic_6mo' }
}
}
payments.createSubscription data
setTimeout -> # Allow buyGems to finish
expect(pushSpy.sendNotify).to.not.have.been.called
done()
, 100