forked from XeroAPI/xero-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
currencies.integration.tests.ts
39 lines (34 loc) · 1.06 KB
/
currencies.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 { CurrenciesResponse } from '../AccountingAPI-responses';
import { AccountingAPIClient } from '../AccountingAPIClient';
import { getPrivateConfig, setJestTimeout } from './helpers/integration.helpers';
describe('/currencies', () => {
let xero: AccountingAPIClient;
beforeAll(async () => {
setJestTimeout();
const config = getPrivateConfig('1');
xero = new AccountingAPIClient(config);
});
it('create', async () => {
expect.assertions(1);
let response: CurrenciesResponse;
try {
response = await xero.currencies.create({ Code: 'PHP' });
expect(response.Currencies).toContainEqual({
Code: 'PHP',
Description: 'Philippine Peso'
});
} catch (err) {
// you can't re-subscribe to a currency you're already subscribed to
expect(err.statusCode).toBe(400);
return;
}
});
it('get all', async () => {
const response = await xero.currencies.get();
expect(response).not.toBeNull();
expect(response.Currencies).toContainEqual({
Code: 'PHP',
Description: 'Philippine Peso'
});
});
});