bunq/test/test.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-09-26 10:07:56 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2019-10-02 21:34:05 +00:00
import { Qenv } from '@pushrocks/qenv';
2019-09-26 10:07:56 +00:00
2019-10-02 21:34:05 +00:00
const testQenv = new Qenv('./', './.nogit/');
2019-09-26 10:07:56 +00:00
2019-10-02 21:34:05 +00:00
import * as bunq from '../ts';
let testBunqAccount: bunq.BunqAccount;
const testBunqOptions: bunq.IBunqConstructorOptions = {
apiKey: testQenv.getEnvVarOnDemand('BUNQ_APIKEY'),
deviceName: 'mojoiobunqpackage',
2020-08-20 01:20:15 +00:00
environment: 'SANDBOX',
2019-10-02 21:34:05 +00:00
};
tap.test('should create a valid bunq account', async () => {
testBunqAccount = new bunq.BunqAccount(testBunqOptions);
expect(testBunqAccount).to.be.instanceOf(bunq.BunqAccount);
});
tap.test('should init the client', async () => {
await testBunqAccount.init();
});
tap.test('should get accounts', async () => {
const accounts = await testBunqAccount.getAccounts();
2019-10-03 12:04:15 +00:00
console.log(accounts);
2019-10-02 21:34:05 +00:00
});
tap.test('should get transactions', async () => {
const accounts = await testBunqAccount.getAccounts();
for (const account of accounts) {
const transactions = await account.getTransactions();
2019-10-03 12:04:15 +00:00
console.log(transactions);
2019-10-02 21:34:05 +00:00
}
});
2019-10-03 12:04:15 +00:00
tap.test('should stop the instance', async () => {
await testBunqAccount.stop();
2020-06-20 01:47:53 +00:00
});
2019-10-03 12:04:15 +00:00
2019-10-02 21:34:05 +00:00
tap.start();