forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adapter.test.ts
37 lines (32 loc) · 966 Bytes
/
adapter.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
import { AdapterRequest } from '@chainlink/ea-bootstrap'
import * as process from 'process'
import { server as startServer } from '../../src'
import { setupExternalAdapterTest } from '@chainlink/ea-test-helpers'
import type { SuiteContext } from '@chainlink/ea-test-helpers'
import { SuperTest, Test } from 'supertest'
describe('execute', () => {
const id = '1'
const context: SuiteContext = {
req: null,
server: startServer,
}
const envVariables = {
API_KEY: process.env.API_KEY || 'fake-api-key',
}
setupExternalAdapterTest(envVariables, context)
describe('EA takes request', () => {
const data: AdapterRequest = {
id,
data: {},
}
it('should return fail', async () => {
await (context.req as SuperTest<Test>)
.post('/')
.send(data)
.set('Accept', '*/*')
.set('Content-Type', 'application/json')
.expect('Content-Type', /json/)
.expect(500)
})
})
})