v3 payments: fix tests

This commit is contained in:
Matteo Pagliazzi
2016-05-10 18:14:28 +02:00
parent d33564e5d4
commit b3a78fba97
6 changed files with 11 additions and 16 deletions

View File

@@ -175,8 +175,6 @@
"resetComplete": "Reset completed", "resetComplete": "Reset completed",
"lvl10ChangeClass": "To change class you must be at least level 10.", "lvl10ChangeClass": "To change class you must be at least level 10.",
"equipmentAlreadyOwned": "You already own that piece of equipment", "equipmentAlreadyOwned": "You already own that piece of equipment",
"missingAccessToken": "The request is missing a required parameter : access_token",
"missingBillingAgreementId": "Missing billing agreement id",
"paymentNotSuccessful": "The payment was not successful", "paymentNotSuccessful": "The payment was not successful",
"planNotActive": "The plan hasn't activated yet (due to a PayPal bug). It will begin <%= nextBillingDate %>, after which you can cancel to retain your full benefits", "planNotActive": "The plan hasn't activated yet (due to a PayPal bug). It will begin <%= nextBillingDate %>, after which you can cancel to retain your full benefits",
"cancelingSubscription": "Canceling the subscription" "cancelingSubscription": "Canceling the subscription"

View File

@@ -10,13 +10,11 @@ describe('payments - amazon - #checkout', () => {
user = await generateUser(); user = await generateUser();
}); });
it('verifies credentials', async (done) => { it('verifies credentials', async () => {
try { await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
await user.post(endpoint); code: 400,
} catch (e) { error: 'BadRequest',
expect(e.error).to.eql('BadRequest'); message: 'Missing req.body.orderReferenceId',
expect(e.message.type).to.eql('InvalidParameterValue'); });
done();
}
}); });
}); });

View File

@@ -1,6 +1,5 @@
import { import {
generateUser, generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3'; } from '../../../../helpers/api-integration/v3';
describe('payments : amazon', () => { describe('payments : amazon', () => {
@@ -15,7 +14,7 @@ describe('payments : amazon', () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({ await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 400, code: 400,
error: 'BadRequest', error: 'BadRequest',
message: t('missingAccessToken'), message: 'Missing req.body.access_token',
}); });
}); });
}); });

View File

@@ -12,6 +12,6 @@ describe('payments - paypal - #ipn', () => {
it('verifies credentials', async () => { it('verifies credentials', async () => {
let result = await user.post(endpoint); let result = await user.post(endpoint);
expect(result).to.eql({}); expect(result).to.eql('OK');
}); });
}); });

View File

@@ -11,7 +11,7 @@ describe('payments - stripe - #checkout', () => {
}); });
it('verifies credentials', async () => { it('verifies credentials', async () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({ await expect(user.post(endpoint, {id: 123})).to.eventually.be.rejected.and.eql({
code: 401, code: 401,
error: 'Error', error: 'Error',
message: 'Invalid API Key provided: ****************************1111', message: 'Invalid API Key provided: ****************************1111',

View File

@@ -13,8 +13,8 @@ describe('payments - stripe - #subscribeEdit', () => {
it('verifies credentials', async () => { it('verifies credentials', async () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({ await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 400, code: 401,
error: 'BadRequest', error: 'NotAuthorized',
message: t('missingSubscription'), message: t('missingSubscription'),
}); });
}); });