forked from XeroAPI/xero-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
banktransactions.integration.tests.ts
39 lines (31 loc) · 1.26 KB
/
banktransactions.integration.tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { AccountingAPIClient } from '../AccountingAPIClient';
import { getPrivateConfig, setJestTimeout } from './helpers/integration.helpers';
describe('/banktransactions', () => {
let xero: AccountingAPIClient;
let existingId: string;
beforeAll(async () => {
setJestTimeout();
const config = getPrivateConfig('1');
xero = new AccountingAPIClient(config);
});
it('can get all', async () => {
const response = await xero.bankTransactions.get();
expect(response.BankTransactions[0].BankTransactionID).toBeDefined();
existingId = response.BankTransactions[0].BankTransactionID;
});
it('can get single', async () => {
const newResponse = await xero.bankTransactions.get({ BankTransactionID: existingId });
expect(newResponse.BankTransactions[0].BankTransactionID).toBeDefined();
});
// it('can get history', async () => {
// const newResponse = await xero.bankTransactions.history.get({ BankTransactionID: existingId });
// expect(newResponse.HistoryRecords[0]).toBeDefined();
// });
it('can update', async () => {
const deleteResult = await xero.bankTransactions.update({
BankTransactionID: existingId,
Status: 'DELETED'
});
expect(deleteResult.BankTransactions[0].Status).toBe('DELETED');
});
});