forked from zestlabs-io/zest-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DistrAPI.test.ts
39 lines (31 loc) · 1.03 KB
/
DistrAPI.test.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
import { DistrConfigServiceApiHMAC } from '../../src/API';
import { DistrconfigPoolType } from '../../src/openapi';
const baseUrl = 'https://dev.zestlabs.cloud';
var distrAPI: DistrConfigServiceApiHMAC;
beforeAll(() => {
return initAPIs();
});
const initAPIs = () => {
const cloudKey = process.env.ZEST_KEY || '';
const cloudSecret = process.env.ZEST_SECRET || '';
distrAPI = new DistrConfigServiceApiHMAC(baseUrl, cloudKey, cloudSecret);
}
test('Create and Pool user', async () => {
const poolId = 'test_pool_1';
const poolCreateResp = await distrAPI.createPool({
id: poolId,
poolType: DistrconfigPoolType.GLOBAL,
pkExtractExpression: '$.pk',
tagExtractExpression: '$.locality'
});
expect(poolCreateResp.status).toBe(200);
// console.log('pool created', poolId);
const resDel = await distrAPI.deletePool(poolId);
expect(resDel.status).toBe(200);
});
test('List users', () => {
const poolId = 'test_pool_1';
expect(async () => {
const mobileUsers = await distrAPI.getUsers();
}).not.toThrowError()
});