-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathzilliqa.test.ts
More file actions
88 lines (76 loc) · 2.51 KB
/
zilliqa.test.ts
File metadata and controls
88 lines (76 loc) · 2.51 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { AdapterRequest } from '@chainlink/ea-bootstrap'
import { assertError, assertSuccess } from '@chainlink/ea-test-helpers'
import { execute } from '../../src/adapter'
import { TInputParameters } from '../../src/endpoint'
/**
* Running these tests requires a connection to a Zilliqa client.
* Not all supported methods have a test case, just enough to display capability.
*/
describe('Zilliqa client @integration', () => {
jest.setTimeout(5000)
const jobID = '278c97ffadb54a5bbb93cfec5f7b5503'
describe('Unrecognized method', () => {
const req = {
id: jobID,
data: {
method: 'no_op',
},
}
it('returns error to the node', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertError({ expected: 500, actual: resp.statusCode }, resp.data, jobID)
})
})
describe('GetNetworkId', () => {
const req = {
id: jobID,
data: {
method: 'GetNetworkId',
params: [''],
},
}
it('returns data to the node', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertSuccess({ expected: 200, actual: resp.statusCode }, resp.data, jobID)
})
})
describe('GetBalance', () => {
const req = {
id: jobID,
data: {
method: 'GetBalance',
params: ['05fE66887AC5B6465f5aEda85E0557A29Ab11936'],
},
}
it('Get balance should return some address balance', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertSuccess({ expected: 200, actual: resp.statusCode }, resp.data, jobID)
})
})
describe('GetBalance', () => {
const req = {
id: jobID,
data: {
method: 'GetBalance',
params: ['05fE66887AC5B6465f5aEda85E0557A29Ab11937'],
},
}
it('Get balance should return error as address is not created.', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertSuccess({ expected: 200, actual: resp.statusCode }, resp.data, jobID)
})
})
describe('GetSmartContractState', () => {
const req = {
id: jobID,
data: {
method: 'GetSmartContractState',
params: ['5865337a32F48a04F5B52507442f47FC558d9C2b'],
},
}
it('returns data to the node', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertSuccess({ expected: 200, actual: resp.statusCode }, resp.data, jobID)
})
})
})