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",
"lvl10ChangeClass": "To change class you must be at least level 10.",
"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",
"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"

View File

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

View File

@@ -1,6 +1,5 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('payments : amazon', () => {
@@ -15,7 +14,7 @@ describe('payments : amazon', () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 400,
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 () => {
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 () => {
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,
error: 'Error',
message: 'Invalid API Key provided: ****************************1111',

View File

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