| 199 | }) as any as DictionaryService<any, any>; |
| 200 | |
| 201 | const getBlockDispatcher = () => { |
| 202 | const inst = { |
| 203 | init: (fn: any) => Promise.resolve(), |
| 204 | latestBufferedHeight: 0, |
| 205 | batchSize: 10, |
| 206 | freeSize: 10, |
| 207 | enqueueBlocks: (heights: number[], latestBufferHeight: number) => { |
| 208 | (inst as any).freeSize = inst.freeSize - heights.length; |
| 209 | inst.latestBufferedHeight = heights.length ? heights[heights.length - 1] : latestBufferHeight; |
| 210 | }, |
| 211 | flushQueue: (height: number) => { |
| 212 | /* TODO */ |
| 213 | }, |
| 214 | } as BlockDispatcher<any, any>; |
| 215 | |
| 216 | return inst; |
| 217 | }; |
| 218 | |
| 219 | jest.mock('../utils/promise', () => { |
| 220 | const original = jest.requireActual('../utils/promise'); |