@@ -9,18 +9,21 @@ import { NearArchiveWatcher } from '../NearArchiveWatcher';
9
9
jest . setTimeout ( 60000 ) ;
10
10
11
11
const INITIAL_NEAR_BLOCK = Number ( INITIAL_DEPLOYMENT_BLOCK_BY_CHAIN . near ?? 0 ) ;
12
+ let archiveWatcher : NearWatcher = new NearArchiveWatcher ( ) ;
12
13
13
14
test ( 'getFinalizedBlockNumber' , async ( ) => {
14
- const watcher = new NearArchiveWatcher ( ) ;
15
- const blockNumber = await watcher . getFinalizedBlockNumber ( ) ;
15
+ const blockNumber = await archiveWatcher . getFinalizedBlockNumber ( ) ;
16
16
expect ( blockNumber ) . toBeGreaterThan ( INITIAL_NEAR_BLOCK ) ;
17
17
} ) ;
18
18
19
19
// No more "too old" blocks
20
20
test ( 'getMessagesForBlocks' , async ( ) => {
21
21
// requests that are too old for rpc node should error, be caught, and return an empty object
22
- const watcher = new NearArchiveWatcher ( ) ;
23
- const messages = await watcher . getMessagesForBlocks ( INITIAL_NEAR_BLOCK , INITIAL_NEAR_BLOCK ) ;
22
+ const messages = await archiveWatcher . getMessagesForBlocks (
23
+ INITIAL_NEAR_BLOCK ,
24
+ INITIAL_NEAR_BLOCK
25
+ ) ;
26
+ console . log ( 'messages' , messages ) ;
24
27
expect ( Object . keys ( messages ) . length ) . toEqual ( 1 ) ;
25
28
} ) ;
26
29
@@ -62,9 +65,8 @@ test('getTransactionsByAccountId', async () => {
62
65
} ) ;
63
66
64
67
describe ( 'getMessagesFromBlockResults' , ( ) => {
65
- test ( 'with Provider' , async ( ) => {
66
- const watcher = new NearArchiveWatcher ( ) ;
67
- const provider = await watcher . getProvider ( ) ;
68
+ test . skip ( 'with Provider' , async ( ) => {
69
+ const provider = await archiveWatcher . getProvider ( ) ;
68
70
const messages = await getMessagesFromBlockResults ( provider , [
69
71
await provider . block ( { finality : 'final' } ) ,
70
72
] ) ;
@@ -89,9 +91,8 @@ describe('getMessagesFromBlockResults', () => {
89
91
} ) ;
90
92
91
93
// validate keys
92
- const watcher = new NearArchiveWatcher ( ) ;
93
94
const blockKey = Object . keys ( messages ) . at ( - 1 ) ! ;
94
- expect ( watcher . isValidBlockKey ( blockKey ) ) . toBe ( true ) ;
95
- expect ( watcher . isValidVaaKey ( messages [ blockKey ] [ 0 ] ) ) . toBe ( true ) ;
95
+ expect ( archiveWatcher . isValidBlockKey ( blockKey ) ) . toBe ( true ) ;
96
+ expect ( archiveWatcher . isValidVaaKey ( messages [ blockKey ] [ 0 ] ) ) . toBe ( true ) ;
96
97
} ) ;
97
98
} ) ;
0 commit comments