forked from XeroAPI/xero-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrackingcategories.integration.tests.ts
58 lines (47 loc) · 2.12 KB
/
trackingcategories.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { AccountingAPIClient } from '../AccountingAPIClient';
import { getPrivateConfig, setJestTimeout } from './helpers/integration.helpers';
describe('/trackingcategories', () => {
let xero: AccountingAPIClient;
beforeAll(() => {
setJestTimeout();
const config = getPrivateConfig();
xero = new AccountingAPIClient(config);
});
// commented out some of the tests for now.
// it('create single', async () => {
// try {
// createResponse = await xero.trackingCategories.create({
// Name: 'Phil Test Category 1'
// });
// } catch (error) {
// const response = await xero.trackingCategories.get();
// await xero.trackingCategories.delete({TrackingCategoryID: response.TrackingCategories[0].TrackingCategoryID});
// createResponse = await xero.trackingCategories.create({
// Name: 'Phil Test Category 1'
// });
// }
// expect(createResponse.TrackingCategories.length).toBe(1);
// expect(createResponse.TrackingCategories[0].Name).toEqual('Phil Test Category 1');
// });
// it('get single', async () => {
// const response = await xero.trackingCategories.get({ TrackingCategoryID: createResponse.TrackingCategories[0].TrackingCategoryID});
// expect(response).toBeDefined();
// expect(response.Id).toBeTruthy();
// expect(response.TrackingCategories.length).toBe(1);
// expect(response.TrackingCategories[0].TrackingCategoryID).toBeTruthy();
// });
it('get all', async () => {
const response = await xero.trackingCategories.get();
expect(response).toBeDefined();
expect(response.Id).toBeTruthy();
expect(response.TrackingCategories.length).toBeGreaterThan(0);
expect(response.TrackingCategories[0].TrackingCategoryID).toBeTruthy();
});
// it('delete single' , async () => {
// const response = await xero.trackingCategories.delete({ TrackingCategoryID: createResponse.TrackingCategories[0].TrackingCategoryID});
// expect(response).toBeDefined();
// expect(response.Id).toBeTruthy();
// expect(response.TrackingCategories.length).toBe(1);
// expect(response.TrackingCategories[0].TrackingCategoryID).toBeTruthy();
// });
});