paypal/test/test.ts
2020-08-23 13:33:19 +00:00

24 lines
844 B
TypeScript

import { expect, tap } from '@pushrocks/tapbundle';
import * as paypal from '../ts/index';
import { Qenv } from '@pushrocks/qenv';
const testQenv = new Qenv('./', './.nogit/');
import * as smarttime from '@pushrocks/smarttime';
let testPayPalInstance: paypal.PayPal;
tap.test('should create a valid paypal instance', async () => {
testPayPalInstance = new paypal.PayPal({
clientId: testQenv.getEnvVarOnDemand('PAYPAL_CLIENT_ID'),
clientSecret: testQenv.getEnvVarOnDemand('PAYPAL_CLIENT_SECRET'),
});
expect(testPayPalInstance).to.be.instanceOf(paypal.PayPal);
});
tap.test('should get an access token', async () => {
const transactions = await paypal.PayPalTransaction.getTransactionFor30days(testPayPalInstance, smarttime.ExtendedDate.fromHyphedDate('2020-05-01').getTime());
console.log(transactions);
});
tap.start();