11import { API_CHAIN_NAMES , ChainId } from '@/utils' ;
2- import { NATIVE_ASSETS } from '@/utils/constants' ;
2+ import { CHAINS , NATIVE_ASSETS } from '@/utils/constants' ;
33import { SorSwapPaths } from '@/data/providers/balancer-api/modules/sorSwapPaths' ;
44import { BalancerApiClient } from '@/data/providers/balancer-api/client' ;
55
@@ -47,6 +47,7 @@ describe('Balancer API (sdk) supports all API chains', () => {
4747
4848 expect ( missingEntries ) . toHaveLength ( 0 ) ;
4949 } ) ;
50+
5051 test ( 'The Balancer Api (sdk) supports the api chains' , ( ) => {
5152 const sorSwapPaths = new SorSwapPaths (
5253 null as unknown as BalancerApiClient ,
@@ -58,24 +59,19 @@ describe('Balancer API (sdk) supports all API chains', () => {
5859 }
5960 }
6061 } ) ;
61- } ) ;
62- describe ( 'Native asset is defined for all API chains' , ( ) => {
63- let supportedChains : SupportedChain [ ] = [ ] ;
64-
65- beforeAll ( async ( ) => {
66- const chainNames = await fetchSupportedChains ( API_ENDPOINT ) ;
6762
68- // Build array of objects: { name, chainId }
69- supportedChains = chainNames . map ( ( name : string ) => {
70- // Find the chainId for this name in API_CHAIN_NAMES
71- const chainIdEntry = Object . entries ( API_CHAIN_NAMES ) . find (
72- ( [ , apiName ] ) => apiName === name ,
73- ) ;
74- return {
75- name,
76- chainId : chainIdEntry ? Number ( chainIdEntry [ 0 ] ) : undefined ,
77- } ;
78- } ) ;
63+ test ( 'API supported chains have CHAINS entries' , ( ) => {
64+ const missingChains : string [ ] = [ ] ;
65+ for ( const { name, chainId } of supportedChains ) {
66+ if ( chainId === undefined ) continue ;
67+ if ( ! CHAINS [ chainId ] ) {
68+ missingChains . push ( `${ name } (${ chainId } )` ) ;
69+ }
70+ }
71+ if ( missingChains . length > 0 ) {
72+ console . error ( 'Missing CHAINS entries for:' , missingChains ) ;
73+ }
74+ expect ( missingChains ) . toHaveLength ( 0 ) ;
7975 } ) ;
8076
8177 test ( 'Native asset is defined for all API chains' , ( ) => {
0 commit comments