-
Notifications
You must be signed in to change notification settings - Fork 308
/
price.test.ts
42 lines (36 loc) · 1.27 KB
/
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
import { AdapterRequest } from '@chainlink/ea-bootstrap'
import process from 'process'
import { server as startServer } from '../../src'
import { mockEthereumResponseSuccess } from './fixtures'
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 = {
ETHEREUM_RPC_URL: process.env.ETHEREUM_RPC_URL || 'http://localhost:8545',
ROUTER_CONTRACT: process.env.ROUTER_CONTRACT || '0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F',
}
setupExternalAdapterTest(envVariables, context)
describe('with vault address', () => {
const data: AdapterRequest = {
id,
data: { address: '0x269616D549D7e8Eaa82DFb17028d0B212D11232A' },
}
it('should return success', async () => {
mockEthereumResponseSuccess()
const response = await (context.req as SuperTest<Test>)
.post('/')
.send(data)
.set('Accept', '*/*')
.set('Content-Type', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
expect(response.body).toMatchSnapshot()
})
})
})