-
Notifications
You must be signed in to change notification settings - Fork 308
/
btc.test.ts
42 lines (36 loc) · 1.19 KB
/
btc.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
39
40
41
42
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 Bitcoin client.
* Not all supported methods have a test case, just enough to display capability.
*/
describe('Bitcoin 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('getinfo', () => {
const req = {
id: jobID,
data: {
method: 'getinfo',
},
}
it('returns data to the node', async () => {
const resp = await execute(req as AdapterRequest<TInputParameters>, {}, {})
assertSuccess({ expected: 200, actual: resp.statusCode }, resp.data, jobID)
})
})
})