Skip to content

Commit

Permalink
Tests: Improve test readability and clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Sep 19, 2023
1 parent ff8717f commit 9e295cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exchanges/sharedtestvalues/sharedtestvalues.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixtu
b := e.GetBase()
seedBase := seed.GetBase()

assert.NoError(t, b.CurrencyPairs.Load(&seedBase.CurrencyPairs), "Loading currency pairs should not error")
err := b.CurrencyPairs.Load(&seedBase.CurrencyPairs)
assert.NoError(t, err, "Loading currency pairs should not error")

b.Name = "fixture"
b.Websocket = &stream.Websocket{
Expand All @@ -167,11 +168,10 @@ func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixtu
b.API.Endpoints = b.NewEndpoints()

fixture, err := os.Open(fixturePath)
if err != nil {
t.Errorf("Error opening test fixture '%v': %v", fixturePath, err)
return
}
defer func() { assert.Nil(t, fixture.Close()) }()
assert.NoError(t, err, "Opening fixture '%s' should not error", fixturePath)
defer func() {
assert.NoError(t, fixture.Close(), "Closing the fixture file should not error")
}()

s := bufio.NewScanner(fixture)
for s.Scan() {
Expand All @@ -180,5 +180,5 @@ func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixtu
t.Errorf("%v from message: %s", err, msg)
}
}
assert.Nil(t, s.Err())
assert.NoError(t, s.Err(), "Fixture Scanner should not error")
}

0 comments on commit 9e295cf

Please sign in to comment.