Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Jul 13, 2017
1 parent 69e48ac commit 5a6c7ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions test/api/v3/unit/libs/amazonPayments.test.js
Expand Up @@ -134,18 +134,17 @@ describe('Amazon Payments', () => {

it('should gift gems', async () => {
let receivingUser = new User();
receivingUser.save();
await receivingUser.save();
let gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
uuid: receivingUser._id,
},
};
amount = 16 / 4;
await amzLib.checkout({gift, user, orderReferenceId, headers});

gift.member = receivingUser;
expect(paymentBuyGemsStub).to.be.calledOnce;
expect(paymentBuyGemsStub).to.be.calledWith({
user,
Expand Down
5 changes: 3 additions & 2 deletions test/api/v3/unit/libs/paypalPayments.test.js
Expand Up @@ -61,7 +61,7 @@ describe('Paypal Payments', () => {
});

it('creates a link for gem purchases', async () => {
let link = await paypalPayments.checkout();
let link = await paypalPayments.checkout({user: new User()});

expect(paypalPaymentCreateStub).to.be.calledOnce;
expect(paypalPaymentCreateStub).to.be.calledWith(getPaypalCreateOptions('Habitica Gems', 5.00));
Expand Down Expand Up @@ -89,11 +89,12 @@ describe('Paypal Payments', () => {

it('creates a link for gifting gems', async () => {
let receivingUser = new User();
await receivingUser.save();
let gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
uuid: receivingUser._id,
},
};

Expand Down
5 changes: 2 additions & 3 deletions test/api/v3/unit/libs/stripePayments.test.js
Expand Up @@ -106,12 +106,12 @@ describe('Stripe Payments', () => {

it('should gift gems', async () => {
let receivingUser = new User();
receivingUser.save();
await receivingUser.save();
gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
uuid: receivingUser._id,
},
};

Expand All @@ -125,7 +125,6 @@ describe('Stripe Payments', () => {
coupon,
}, stripe);

gift.member = receivingUser;
expect(stripeChargeStub).to.be.calledOnce;
expect(stripeChargeStub).to.be.calledWith({
amount: '400',
Expand Down

0 comments on commit 5a6c7ac

Please sign in to comment.