@@ -14,6 +14,7 @@ import { RewardsService } from 'events/rewards/rewards.service';
14
14
import { SECONDS_PER_SLOT , SLOTS_PER_EPOCH } from 'common/genesis-time' ;
15
15
16
16
import { WaitingTimeCalculationType } from './waiting-time.types' ;
17
+ import { SimpleFallbackJsonRpcBatchProvider } from '@lido-nestjs/execution' ;
17
18
18
19
jest . mock ( 'common/config' , ( ) => ( { } ) ) ;
19
20
@@ -24,6 +25,7 @@ describe('WaitingTimeService', () => {
24
25
let contractConfig : ContractConfigStorageService ;
25
26
let genesisTimeService : GenesisTimeService ;
26
27
let validatorsStorage : ValidatorsStorageService ;
28
+ let rpcBatchProvider : SimpleFallbackJsonRpcBatchProvider ;
27
29
28
30
// constants
29
31
const genesisTime = 1606824023 ;
@@ -108,6 +110,12 @@ describe('WaitingTimeService', () => {
108
110
getFrameBalances : jest . fn ( ) ,
109
111
} ,
110
112
} ,
113
+ {
114
+ provide : SimpleFallbackJsonRpcBatchProvider ,
115
+ useValue : {
116
+ getBlock : jest . fn ( ) ,
117
+ } ,
118
+ } ,
111
119
{
112
120
provide : GenesisTimeService ,
113
121
useValue : {
@@ -130,6 +138,7 @@ describe('WaitingTimeService', () => {
130
138
contractConfig = moduleRef . get < ContractConfigStorageService > ( ContractConfigStorageService ) ;
131
139
genesisTimeService = moduleRef . get < GenesisTimeService > ( GenesisTimeService ) ;
132
140
validatorsStorage = moduleRef . get < ValidatorsStorageService > ( ValidatorsStorageService ) ;
141
+ rpcBatchProvider = moduleRef . get < SimpleFallbackJsonRpcBatchProvider > ( SimpleFallbackJsonRpcBatchProvider ) ;
133
142
134
143
// mocks
135
144
jest . spyOn ( contractConfig , 'getInitialEpoch' ) . mockReturnValue ( initialEpoch ) ;
@@ -145,6 +154,8 @@ describe('WaitingTimeService', () => {
145
154
jest . spyOn ( validatorsStorage , 'getActiveValidatorsCount' ) . mockReturnValue ( 10000 ) ;
146
155
jest . spyOn ( validatorsStorage , 'getFrameBalances' ) . mockReturnValue ( { } ) ;
147
156
jest . spyOn ( service , 'getFrameIsBunker' ) . mockReturnValue ( null ) ;
157
+ // needed for mock only block number
158
+ jest . spyOn ( rpcBatchProvider , 'getBlock' ) . mockResolvedValue ( { number : 21367114 } as any ) ;
148
159
} ) ;
149
160
150
161
afterEach ( async ( ) => {
0 commit comments