-
Notifications
You must be signed in to change notification settings - Fork 6
/
por.test.ts
44 lines (41 loc) · 1.26 KB
/
por.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
44
import { NopTransport, TestAdapter } from '../src/util/testing-utils'
import untypedTest, { TestFn } from 'ava'
import { PoRAdapter, PoRBalanceEndpoint } from '../src/adapter/por'
import { AdapterConfig } from '../src/config'
type TestContext = {
testAdapter: TestAdapter
}
const test = untypedTest as TestFn<TestContext>
test('PoRAdapter has BACKGROUND_EXECUTE_TIMEOUT setting set to highest value as default', async (t) => {
const adapter = new PoRAdapter({
name: 'TEST',
config: new AdapterConfig({
test: { description: 'test', type: 'string' },
}),
endpoints: [
new PoRBalanceEndpoint({
name: 'test',
transport: new NopTransport(),
}),
],
})
t.is(adapter.config.settings.BACKGROUND_EXECUTE_TIMEOUT, 180_000)
})
test('PoRAdapter uses BACKGROUND_EXECUTE_TIMEOUT value if provided', async (t) => {
const adapter = new PoRAdapter({
name: 'TEST',
config: new AdapterConfig(
{
test: { description: 'test', type: 'string' },
},
{ envDefaultOverrides: { BACKGROUND_EXECUTE_TIMEOUT: 100 } },
),
endpoints: [
new PoRBalanceEndpoint({
name: 'test',
transport: new NopTransport(),
}),
],
})
t.is(adapter.config.settings.BACKGROUND_EXECUTE_TIMEOUT, 100)
})