File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Provider } from '../src' ;
2+ import { SupportedRpcVersion } from '../src/global/constants' ;
3+ import { getDefaultNodes } from '../src/utils/provider' ;
4+ import { describeIfTestnet } from './config/fixtures' ;
5+
6+ describeIfTestnet ( 'Default RPC Nodes' , ( ) => {
7+ test ( 'All Default RPC Nodes support Spec Versions' , async ( ) => {
8+ const finalResult = await Promise . all (
9+ Object . keys ( SupportedRpcVersion ) . map ( async ( rpcv ) => {
10+ const rpcNodes = getDefaultNodes ( rpcv as SupportedRpcVersion ) ;
11+
12+ const result = await Promise . all (
13+ Object . keys ( rpcNodes ) . map ( async ( network : any ) => {
14+ return Promise . all (
15+ rpcNodes [ network as keyof typeof rpcNodes ] . map ( async ( it : any ) => {
16+ const provider = new Provider ( { nodeUrl : it } ) ;
17+ let version ;
18+ try {
19+ version = await provider . getSpecVersion ( ) ;
20+ } catch ( error ) {
21+ version = undefined ;
22+ }
23+
24+ return {
25+ network,
26+ nodeUrl : provider . channel . nodeUrl ,
27+ version,
28+ } ;
29+ } )
30+ ) ;
31+ } )
32+ ) ;
33+
34+ console . table ( result . flat ( ) ) ;
35+ return result
36+ . flat ( )
37+ . map ( ( it ) => it . version )
38+ . includes ( undefined ) ;
39+ } )
40+ ) ;
41+
42+ expect ( finalResult . includes ( true ) ) . toBeFalsy ( ) ;
43+ } ) ;
44+ } ) ;
You can’t perform that action at this time.
0 commit comments