Skip to content

Commit 201749e

Browse files
authored
Fix compilation errors in stader-balace test (#3786)
1 parent 8ebcbd7 commit 201749e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

.github/workflows/checks.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,17 @@ jobs:
7373
- name: Compile tests
7474
env:
7575
CHANGED_PACKAGES: ${{ needs.install-packages.outputs.changed-packages }}
76-
run: yarn tsc -b --noEmit $(echo $CHANGED_PACKAGES | jq '.[].location + "/tsconfig.test.json"' -r | grep -v -E '/composites/dydx-rewards/|/composites/glv-token/|/composites/gm-token/|/core/bootstrap/|/sources/aleno/|/sources/bitgo-reserves-test/|/sources/bitgo-reserves/|/sources/coinpaprika/|/sources/cryptocompare/|/sources/dlc-btc-por/|/sources/eth-beacon/|/sources/icap/|/sources/ipfs/|/sources/layer2-sequencer-health/|/sources/por-address-list/|/sources/s3-csv-reader/|/sources/stader-balance/|/sources/token-balance/|/sources/view-function-multi-chain/|sources/view-function/')
76+
FAILING_TESTS_PATTERN: '/composites/dydx-rewards/|/composites/glv-token/|/composites/gm-token/|/core/bootstrap/|/sources/aleno/|/sources/bitgo-reserves-test/|/sources/bitgo-reserves/|/sources/coinpaprika/|/sources/cryptocompare/|/sources/dlc-btc-por/|/sources/eth-beacon/|/sources/icap/|/sources/ipfs/|/sources/layer2-sequencer-health/|/sources/por-address-list/|/sources/s3-csv-reader/|/sources/token-balance/|/sources/view-function-multi-chain/|sources/view-function/'
77+
run: |
78+
# Tests that should compile:
79+
yarn tsc -b --noEmit $(echo $CHANGED_PACKAGES | jq '.[].location + "/tsconfig.test.json"' -r | grep -v -E "$FAILING_TESTS_PATTERN")
80+
# Tests that should not compile:
81+
for package in $(echo "$CHANGED_PACKAGES" | jq '.[].location + "/"' -r | grep -E "$FAILING_TESTS_PATTERN"); do
82+
if yarn tsc -b --noEmit "${package}tsconfig.test.json"; then
83+
echo "Compilation succeeded for $package. Remove it from FAILING_TESTS_PATTERN so it doesn't break again in the future."
84+
exit 1
85+
fi
86+
done
7787
7888
# Run unit tests
7989
unit-tests:

packages/sources/stader-balance/test/integration/adapter.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type BigNumber from 'bignumber.js'
12
import {
23
addressData,
34
mockCollateralEthMap,
@@ -17,11 +18,16 @@ import {
1718
import { deferredPromise, sleep } from '@chainlink/external-adapter-framework/util'
1819
import * as nock from 'nock'
1920

20-
const totalPenaltyAmountCalls = {}
21+
type TotalPenaltyAmountCall = {
22+
resolve: () => void
23+
promise: Promise<BigNumber>
24+
}
25+
26+
const totalPenaltyAmountCalls: Record<string, TotalPenaltyAmountCall> = {}
2127

22-
const getTotalPenaltyAmount = (address) => {
28+
const getTotalPenaltyAmount = (address: string) => {
2329
if (!(address in totalPenaltyAmountCalls)) {
24-
const [promise, resolve] = deferredPromise()
30+
const [promise, resolve] = deferredPromise<BigNumber>()
2531
totalPenaltyAmountCalls[address] = {
2632
resolve: () => resolve(mockPenaltyMap[address]),
2733
promise,

0 commit comments

Comments
 (0)