@@ -896,55 +896,31 @@ mod tests {
896896
897897 #[ test]
898898 fn test_config_allows_empty_network_tokens ( ) {
899- let config_str = r#"
900- [solver]
901- id = "test-empty-tokens"
902- monitoring_timeout_minutes = 5
903- min_profitability_pct = 1.0
904-
905- [networks.1]
906- input_settler_address = "0x1234567890123456789012345678901234567890"
907- output_settler_address = "0x0987654321098765432109876543210987654321"
908- tokens = []
909- [[networks.1.rpc_urls]]
910- http = "http://localhost:8545"
911-
912- [networks.2]
913- input_settler_address = "0x1234567890123456789012345678901234567890"
914- output_settler_address = "0x0987654321098765432109876543210987654321"
915- tokens = []
916- [[networks.2.rpc_urls]]
917- http = "http://localhost:8546"
918-
919- [storage]
920- primary = "memory"
921- cleanup_interval_seconds = 3600
922- [storage.implementations.memory]
923-
924- [delivery]
925- [delivery.implementations.test]
926-
927- [account]
928- primary = "local"
929- [account.implementations.local]
930- private_key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
931-
932- [discovery]
933- [discovery.implementations.test]
934-
935- [order]
936- [order.implementations.test]
937- [order.strategy]
938- primary = "simple"
939- [order.strategy.implementations.simple]
940-
941- [settlement]
942- [settlement.implementations.test]
943- order = "test"
944- network_ids = [1, 2]
945- "# ;
946-
947- let config: Config = config_str. parse ( ) . expect ( "Config should parse" ) ;
899+ fn empty_token_network ( rpc_url : & str ) -> serde_json:: Value {
900+ json ! ( {
901+ "input_settler_address" : "0x1234567890123456789012345678901234567890" ,
902+ "output_settler_address" : "0x0987654321098765432109876543210987654321" ,
903+ "rpc_urls" : [ { "http" : rpc_url } ] ,
904+ "tokens" : [ ]
905+ } )
906+ }
907+
908+ let config = parse_json_fixture ( base_config_json (
909+ json ! ( {
910+ "1" : empty_token_network( "http://localhost:8545" ) ,
911+ "2" : empty_token_network( "http://localhost:8546" )
912+ } ) ,
913+ json ! ( {
914+ "test" : { }
915+ } ) ,
916+ json ! ( {
917+ "test" : {
918+ "order" : "test" ,
919+ "network_ids" : [ 1 , 2 ]
920+ }
921+ } ) ,
922+ ) )
923+ . expect ( "Config should parse" ) ;
948924 assert_eq ! ( config. networks. get( & 1 ) . unwrap( ) . tokens. len( ) , 0 ) ;
949925 assert_eq ! ( config. networks. get( & 2 ) . unwrap( ) . tokens. len( ) , 0 ) ;
950926 }
0 commit comments