Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test-payload.json for EAs. pt 2 #3092

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion packages/composites/circuit-breaker/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
"secondarySource": "coinmarketcap",
"base": "ETH",
"quote": "USD"
}]
},
{
"primarySource": "coingecko",
"secondarySource": "coinmarketcap",
"base": "ETH",
"quote": "USD",
"endpoint": "circuit"
}]
}
15 changes: 15 additions & 0 deletions packages/composites/circuit-breaker/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { AdapterRequest } from '@chainlink/ea-bootstrap'
import { makeExecute } from '../../src/adapter'
import { makeConfig } from '../../src/config'
import { TInputParameters } from '../../src/endpoint'
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('execute', () => {
const jobID = '1'
Expand All @@ -28,3 +30,16 @@ describe('execute', () => {
})
})
})

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/circuit-breaker/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
5 changes: 5 additions & 0 deletions packages/composites/defi-dozen/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"requests": [{
"from": "LINK",
"to": "USD"
},
{
"from": "LINK",
"to": "USD",
"endpoint": "allocation"
}]
}
15 changes: 15 additions & 0 deletions packages/composites/defi-dozen/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/defi-dozen/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
3 changes: 2 additions & 1 deletion packages/composites/implied-price/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ETH": "ethereum"
}
}
}
},
"endpoint": "impliedPrice"
}]
}
15 changes: 15 additions & 0 deletions packages/composites/implied-price/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { median, parseSources } from '../../src/endpoint/impliedPrice'
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('parseSources', () => {
it('parses an array of sources', () => {
Expand All @@ -23,3 +25,16 @@ describe('median', () => {
expect(median([1, 2]).toNumber()).toEqual(1.5)
})
})

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/implied-price/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
6 changes: 5 additions & 1 deletion packages/composites/nftx/test-payload.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"requests": [{
"address": "0x269616D549D7e8Eaa82DFb17028d0B212D11232A"
}]
},
{
"address": "0x269616D549D7e8Eaa82DFb17028d0B212D11232A",
"endpoint": "price"
}]
}
15 changes: 15 additions & 0 deletions packages/composites/nftx/test/unit/price.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { assertError } from '@chainlink/ea-test-helpers'
import { AdapterRequest } from '@chainlink/ea-bootstrap'
import { makeExecute } from '../../src/adapter'
import { TInputParameters } from '../../src/endpoint'
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('execute', () => {
const jobID = '1'
Expand Down Expand Up @@ -31,3 +33,16 @@ describe('execute', () => {
})
})
})

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/nftx/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
6 changes: 6 additions & 0 deletions packages/composites/reference-transform/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"referenceContract": "0x1B58B67B2b2Df71b4b0fb6691271E83A0fa36aC5",
"operator": "multiply",
"source": "coingecko"
},
{
"referenceContract": "0x1B58B67B2b2Df71b4b0fb6691271E83A0fa36aC5",
"operator": "multiply",
"source": "coingecko",
"endpoint": "transform"
}
]
}
15 changes: 15 additions & 0 deletions packages/composites/reference-transform/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/reference-transform/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
7 changes: 6 additions & 1 deletion packages/composites/savax-price/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"requests": [{
"from": "SAVAX",
"to": "USD"
}]
},
{
"from": "SAVAX",
"to": "USD",
"endpoint": "price"
}]
}
15 changes: 15 additions & 0 deletions packages/composites/savax-price/test/unit/price.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { DEFAULT_SAVAX_ADDRESS, makeConfig } from '../../src/config'
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('execute', () => {
describe('config', () => {
Expand All @@ -25,3 +27,16 @@ describe('execute', () => {
})
})
})

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/savax-price/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
19 changes: 18 additions & 1 deletion packages/composites/xsushi-price/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@
"requests": [{
"from": "xSUSHI",
"to": "USD"
}]
},
{
"from": "xSUSHI",
"to": "USD",
"endpoint": "price"
},
{
"from": "xSUSHI",
"to": "USD",
"endpoint": "crypto"
},
{
"endpoint": "ratio"
},
{
"endpoint": "sushi"
}
]
}
15 changes: 15 additions & 0 deletions packages/composites/xsushi-price/test/unit/price.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { makeExecute } from '../../src'
import { ENV_ETHEREUM_RPC_URL } from '../../src/config'
import * as process from 'process'
import { TInputParameters } from '../../src/endpoint'
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('execute', () => {
const jobID = '1'
Expand Down Expand Up @@ -33,3 +35,16 @@ describe('execute', () => {
})
})
})

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/composites/xsushi-price/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
7 changes: 7 additions & 0 deletions packages/sources/btc.com/test-payload.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"requests": [{
"endpoint": "balance",
"addresses": [
{
"address": "3EyjZ6CtEZEKyc719NZMyWaJpJG5jsVJL1",
Expand All @@ -11,6 +12,12 @@
}
],
"dataPath": "addresses"
},
{
"endpoint": "height"
},
{
"endpoint": "difficulty"
}
]
}
15 changes: 15 additions & 0 deletions packages/sources/btc.com/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as endpoints from '../../src/endpoint'
import testPayload from '../../test-payload.json'

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = Object.keys(endpoints)
.map((e) => [...(endpoints[e as keyof typeof endpoints].supportedEndpoints || [])])
.flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/sources/btc.com/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
7 changes: 6 additions & 1 deletion packages/sources/clear-bank/test-payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"requests": [{
"accountIDs": ["GB44CLRB04084000000010"],
"currency": "GBP"
}]
},
{
"endpoint": "accounts",
"accountIDs": ["GB44CLRB04084000000010"],
"currency": "GBP"
}]
}
13 changes: 13 additions & 0 deletions packages/sources/clear-bank/test/unit/adapter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { adapter } from '../../src'
import testPayload from '../../test-payload.json'

describe('test-payload.json', () => {
it('should contain all endpoints/aliases', () => {
const endpointsWithAliases = adapter.endpoints.map((e) => [e.name, ...(e.aliases || [])]).flat()
endpointsWithAliases.forEach((alias) => {
const requests = testPayload.requests as { endpoint?: string }[]
const aliasedRequest = requests.find((req) => req?.endpoint === alias)
expect(aliasedRequest).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion packages/sources/clear-bank/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "**/test", "src/**/*.json"],
"include": ["src/**/*", "**/test", "src/**/*.json", "test-payload.json"],
"compilerOptions": {
"noEmit": true
}
Expand Down
Loading
Loading