forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
price.test.ts
43 lines (40 loc) · 1000 Bytes
/
price.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
43
import { assertSuccess } from '@chainlink/ea-test-helpers'
import { AdapterRequest } from '@chainlink/types'
import { makeExecute } from '../../src/adapter'
describe('execute', () => {
const jobID = '1'
const execute = makeExecute()
process.env.API_KEY = process.env.API_KEY ?? 'test_api_key'
describe('successful requests', () => {
const requests = [
{
name: 'id not supplied',
testData: {
data: {},
},
},
{
name: 'last not supplied',
testData: {
data: {
series: 'DPCERG',
},
},
},
{
name: 'serie not supplied',
testData: {
data: {
last: 4,
},
},
},
]
requests.forEach((req) => {
it(`${req.name}`, async () => {
const adapterResponse = await execute(req.testData as AdapterRequest)
assertSuccess(adapterResponse.statusCode, adapterResponse, jobID)
})
})
})
})