Skip to content

Commit

Permalink
strip newline
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Mar 26, 2024
1 parent 65a3ebd commit 7220dc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 6 additions & 9 deletions core/cmd/starknet_node_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,16 @@ func TestShell_IndexStarkNetNodes(t *testing.T) {

id := "starknet chain ID"
node1 := config.Node{
Name: ptr("first"),
URL: commoncfg.MustParseURL("https://starknet1.example"),
APIKey: ptr("key"),
Name: ptr("first"),
URL: commoncfg.MustParseURL("https://starknet1.example"),
}
node2 := config.Node{
Name: ptr("second"),
URL: commoncfg.MustParseURL("https://starknet2.example"),
APIKey: ptr("key"),
Name: ptr("second"),
URL: commoncfg.MustParseURL("https://starknet2.example"),
}
chain := config.TOMLConfig{
ChainID: &id,
Nodes: config.Nodes{&node1, &node2},
FeederURL: commoncfg.MustParseURL("http://feeder.url"),
ChainID: &id,
Nodes: config.Nodes{&node1, &node2},
}
app := starknetStartNewApplication(t, &chain)
client, r := app.NewShellAndRenderer()
Expand Down
8 changes: 8 additions & 0 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,12 +1138,19 @@ CertFile = '/path/to/cert.pem'
t.Run(tt.name, func(t *testing.T) {
s, err := tt.config.TOMLString()
require.NoError(t, err)

// parsing from TOML requires stripping new lines
if tt.name == "full" || tt.name == "multi-chain" {
s = strings.TrimRight(s, "\n")
}

assert.Equal(t, tt.exp, s, diff.Diff(tt.exp, s))

var got Config

require.NoError(t, config.DecodeTOML(strings.NewReader(s), &got))
ts, err := got.TOMLString()

require.NoError(t, err)
assert.Equal(t, tt.config, got, diff.Diff(s, ts))
})
Expand Down Expand Up @@ -1549,6 +1556,7 @@ func TestConfig_SetFrom(t *testing.T) {
require.NoError(t, c.SetFrom(&f))
}
ts, err := c.TOMLString()
ts = strings.TrimRight(ts, "\n")
require.NoError(t, err)
assert.Equal(t, tt.exp, ts)
})
Expand Down

0 comments on commit 7220dc3

Please sign in to comment.