Skip to content

Commit a3f2638

Browse files
committed
fix broken tests
1 parent 215be4c commit a3f2638

File tree

27 files changed

+201
-324
lines changed

27 files changed

+201
-324
lines changed

lib/agent/fixtures/swap/index.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import { createSwapEthAndStakeDevPolygonCaller } from './swapEthAndStakeDevPolyg
99
jest.mock('./getEstimatedDevForEth')
1010
jest.mock('./getEstimatedEthForDev')
1111
jest.mock('./swapEthAndStakeDev')
12+
jest.mock('ethers')
1213

1314
describe('swap/index.ts', () => {
1415
;(createGetEstimatedDevForEthCaller as jest.Mock).mockImplementation(
15-
(contract) => contract
16+
() => 123
1617
)
1718
;(createGetEstimatedEthForDevCaller as jest.Mock).mockImplementation(
18-
(contract) => contract
19-
)
20-
;(createSwapEthAndStakeDevCaller as jest.Mock).mockImplementation(
21-
(contract) => contract
19+
() => 123
2220
)
21+
;(createSwapEthAndStakeDevCaller as jest.Mock).mockImplementation(() => 123)
22+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
2323

2424
describe('createSwapContract', () => {
2525
it('check return object', () => {

lib/common/erc20/index.spec.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,18 @@ jest.mock('./name')
1919
jest.mock('./symbol')
2020
jest.mock('./decimals')
2121
jest.mock('./allowance')
22+
jest.mock('ethers')
2223

2324
describe('erc20/index.ts', () => {
24-
;(createBalanceOfCaller as jest.Mock).mockImplementation(
25-
(contract) => contract
26-
)
27-
;(createTotalSupplyCaller as jest.Mock).mockImplementation(
28-
(contract) => contract
29-
)
30-
;(createApproveCaller as jest.Mock).mockImplementation((contract) => contract)
31-
;(createTransferFromCaller as jest.Mock).mockImplementation(
32-
(contract) => contract
33-
)
34-
;(createNameCaller as jest.Mock).mockImplementation((contract) => contract)
35-
;(createSymbolCaller as jest.Mock).mockImplementation((contract) => contract)
36-
;(createDecimalsCaller as jest.Mock).mockImplementation(
37-
(contract) => contract
38-
)
39-
;(createAllowanceCaller as jest.Mock).mockImplementation(
40-
(contract) => contract
41-
)
25+
;(createBalanceOfCaller as jest.Mock).mockImplementation(() => 123)
26+
;(createTotalSupplyCaller as jest.Mock).mockImplementation(() => 123)
27+
;(createApproveCaller as jest.Mock).mockImplementation(() => 123)
28+
;(createTransferFromCaller as jest.Mock).mockImplementation(() => 123)
29+
;(createNameCaller as jest.Mock).mockImplementation(() => 123)
30+
;(createSymbolCaller as jest.Mock).mockImplementation(() => 123)
31+
;(createDecimalsCaller as jest.Mock).mockImplementation(() => 123)
32+
;(createAllowanceCaller as jest.Mock).mockImplementation(() => 123)
33+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
4234

4335
describe('createErc20Contract', () => {
4436
it('check return object', () => {

lib/common/utils/for-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
TransactionResponse,
1414
TransactionReceipt,
1515
} from '@ethersproject/abstract-provider'
16-
import { BigNumber } from '@ethersproject/bignumber'
16+
import type { BigNumber } from '@ethersproject/bignumber'
1717

1818
export type StubTransactionResposeFactory = (p: {
1919
readonly hash?: string

lib/ethereum/allocator/index.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { createCalculateMaxRewardsPerBlockCaller } from './calculateMaxRewardsPe
44
import { allocatorAbi } from './abi'
55

66
jest.mock('./calculateMaxRewardsPerBlock')
7+
jest.mock('ethers')
78

89
describe('allocator/index.ts', () => {
910
describe('createAllocatorContract', () => {
1011
;(createCalculateMaxRewardsPerBlockCaller as jest.Mock).mockImplementation(
11-
(contract) => contract
12+
() => 123
1213
)
14+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
1315
it('check return object', () => {
1416
const host = 'localhost'
1517
const address = 'address'

lib/ethereum/dev/index.spec.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,19 @@ jest.mock('./../../common/erc20/name')
2121
jest.mock('./../../common/erc20/symbol')
2222
jest.mock('./../../common/erc20/decimals')
2323
jest.mock('./../../common/erc20/allowance')
24+
jest.mock('ethers')
2425

2526
describe('dev/index.ts', () => {
26-
;(createDepositCaller as jest.Mock).mockImplementation((contract) => contract)
27-
;(createBalanceOfCaller as jest.Mock).mockImplementation(
28-
(contract) => contract
29-
)
30-
;(createTotalSupplyCaller as jest.Mock).mockImplementation(
31-
(contract) => contract
32-
)
33-
;(createApproveCaller as jest.Mock).mockImplementation((contract) => contract)
34-
;(createTransferFromCaller as jest.Mock).mockImplementation(
35-
(contract) => contract
36-
)
37-
;(createNameCaller as jest.Mock).mockImplementation((contract) => contract)
38-
;(createSymbolCaller as jest.Mock).mockImplementation((contract) => contract)
39-
;(createDecimalsCaller as jest.Mock).mockImplementation(
40-
(contract) => contract
41-
)
42-
;(createAllowanceCaller as jest.Mock).mockImplementation(
43-
(contract) => contract
44-
)
27+
;(createDepositCaller as jest.Mock).mockImplementation(() => 123)
28+
;(createBalanceOfCaller as jest.Mock).mockImplementation(() => 123)
29+
;(createTotalSupplyCaller as jest.Mock).mockImplementation(() => 123)
30+
;(createApproveCaller as jest.Mock).mockImplementation(() => 123)
31+
;(createTransferFromCaller as jest.Mock).mockImplementation(() => 123)
32+
;(createNameCaller as jest.Mock).mockImplementation(() => 123)
33+
;(createSymbolCaller as jest.Mock).mockImplementation(() => 123)
34+
;(createDecimalsCaller as jest.Mock).mockImplementation(() => 123)
35+
;(createAllowanceCaller as jest.Mock).mockImplementation(() => 123)
36+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
4537

4638
describe('createDevContract', () => {
4739
it('check return object', () => {

lib/ethereum/lockup/index.spec.ts

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,47 +31,35 @@ jest.mock('./depositToPosition')
3131
jest.mock('./withdrawByPosition')
3232
jest.mock('./migrateToSTokens')
3333
jest.mock('./calculateWithdrawableInterestAmountByPosition')
34+
jest.mock('ethers')
3435

3536
describe('lockup/index.ts', () => {
36-
;(createGetPropertyValueCaller as jest.Mock).mockImplementation(
37-
(contract) => contract
38-
)
39-
;(createWithdrawCaller as jest.Mock).mockImplementation(
40-
(contract) => contract
41-
)
37+
;(createGetPropertyValueCaller as jest.Mock).mockImplementation(() => 123)
38+
;(createWithdrawCaller as jest.Mock).mockImplementation(() => 123)
4239
;(
4340
createCalculateWithdrawableInterestAmountCaller as jest.Mock
44-
).mockImplementation((contract) => contract)
45-
;(createGetAllValueCaller as jest.Mock).mockImplementation(
46-
(contract) => contract
47-
)
41+
).mockImplementation(() => 123)
42+
;(createGetAllValueCaller as jest.Mock).mockImplementation(() => 123)
4843
;(createGetStorageWithdrawalStatusCaller as jest.Mock).mockImplementation(
49-
(contract) => contract
44+
() => 123
5045
)
5146
;(
5247
createCalculateCumulativeHoldersRewardAmountCaller as jest.Mock
53-
).mockImplementation((contract) => contract)
48+
).mockImplementation(() => 123)
5449
;(
5550
createCalculateCumulativeRewardPricesCaller as jest.Mock
56-
).mockImplementation((contract) => contract)
51+
).mockImplementation(() => 123)
5752
;(createCalculateRewardAmountCaller as jest.Mock).mockImplementation(
58-
(contract) => contract
59-
)
60-
;(createDepositToPropertyCaller as jest.Mock).mockImplementation(
61-
(contract) => contract
62-
)
63-
;(createDepositToPositionCaller as jest.Mock).mockImplementation(
64-
(contract) => contract
65-
)
66-
;(createWithdrawByPositionCaller as jest.Mock).mockImplementation(
67-
(contract) => contract
68-
)
69-
;(createMigrateToSTokensCaller as jest.Mock).mockImplementation(
70-
(contract) => contract
53+
() => 123
7154
)
55+
;(createDepositToPropertyCaller as jest.Mock).mockImplementation(() => 123)
56+
;(createDepositToPositionCaller as jest.Mock).mockImplementation(() => 123)
57+
;(createWithdrawByPositionCaller as jest.Mock).mockImplementation(() => 123)
58+
;(createMigrateToSTokensCaller as jest.Mock).mockImplementation(() => 123)
7259
;(
7360
createcalculateWithdrawableInterestAmountByPositionCaller as jest.Mock
74-
).mockImplementation((contract) => contract)
61+
).mockImplementation(() => 123)
62+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
7563

7664
describe('createLockupContract', () => {
7765
it('check return object', () => {

lib/ethereum/market-behavior/index.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import { createGetMetricsCaller } from './getMetrics'
55
import { marketBehaviorAbi } from './abi'
66

77
jest.mock('./getId')
8+
jest.mock('ethers')
89

910
describe('getId/index.ts', () => {
10-
;(createGetIdCaller as jest.Mock).mockImplementation((contract) => contract)
11+
;(createGetIdCaller as jest.Mock).mockImplementation(() => 123)
12+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
1113
describe('createMarketBehaviorContract', () => {
1214
it('check return object', () => {
1315
const host = 'localhost'

lib/ethereum/market-factory/index.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { marketFactoryAbi } from './abi'
44
import { createCreateCaller } from './create'
55

66
jest.mock('./create')
7+
jest.mock('ethers')
78

89
describe('market-factory/index.ts', () => {
9-
;(createCreateCaller as jest.Mock).mockImplementation((contract) => contract)
10+
;(createCreateCaller as jest.Mock).mockImplementation(() => 123)
11+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
1012
describe('createMarketFactoryContract', () => {
1113
it('check return object', () => {
1214
const host = 'localhost'

lib/ethereum/metrics-group/index.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { createTotalIssuedMetrics } from './totalIssuedMetrics'
66

77
jest.mock('./totalAuthenticatedProperties')
88
jest.mock('./totalIssuedMetrics')
9+
jest.mock('ethers')
910

1011
describe('metrics-group.ts', () => {
1112
;(createTotalAuthenticatedPropertiesCaller as jest.Mock).mockImplementation(
12-
(contract) => contract
13-
)
14-
;(createTotalIssuedMetrics as jest.Mock).mockImplementation(
15-
(contract) => contract
13+
() => 123
1614
)
15+
;(createTotalIssuedMetrics as jest.Mock).mockImplementation(() => 123)
16+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
1717
describe('createMetricsGroupContract', () => {
1818
it('check return object', () => {
1919
const host = 'localhost'

lib/ethereum/metrics/index.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { metricsAbi } from './abi'
66

77
jest.mock('./property')
88
jest.mock('./market')
9+
jest.mock('ethers')
910

1011
describe('metrics/index.ts', () => {
11-
;(createPropertyCaller as jest.Mock).mockImplementation(
12-
(contract) => contract
13-
)
14-
;(createMarketCaller as jest.Mock).mockImplementation((contract) => contract)
12+
;(createPropertyCaller as jest.Mock).mockImplementation(() => 123)
13+
;(createMarketCaller as jest.Mock).mockImplementation(() => 123)
14+
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
1515
describe('createMetricsContract', () => {
1616
it('check return object', () => {
1717
const host = 'localhost'

0 commit comments

Comments
 (0)