test ignore old chain id format
@@ -72,3 +72,23 @@ func Test_TransformNetworkToJSON(t *testing.T) {
assert.Equal(t, string(b), string(x))
}
+
+func Test_IngoreOldFormat(t *testing.T) {
+ b := []byte(`{
+ "emulator":"127.0.0.1:3569",
+ "testnet":"access.testnet.nodes.onflow.org:9000",
+ "mainnet": {
+ "host": "access.mainnet.nodes.onflow.org:9000",
+ "chain": "flow-mainnet"
+ }
+ }`)
+
+ var jsonNetworks jsonNetworks
+ err := json.Unmarshal(b, &jsonNetworks)
+ assert.NoError(t, err)
+
+ conf := jsonNetworks.transformToConfig()
+ assert.Len(t, jsonNetworks, 3)
+ assert.Equal(t, conf.GetByName("testnet").Host, "access.testnet.nodes.onflow.org:9000")
+ assert.Equal(t, conf.GetByName("mainnet").Host, "access.mainnet.nodes.onflow.org:9000")
+}
