Skip to content

Commit

Permalink
Update test to upsert correctly now, and change assertion order
Browse files Browse the repository at this point in the history
The order is expected, actual so the error messages make more
sense if we swap the ID order.
  • Loading branch information
Shaptic committed Nov 4, 2021
1 parent 767f312 commit 5d3ebf8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions services/horizon/internal/actions/liquidity_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,11 @@ func TestGetLiquidityPools(t *testing.T) {
t.Run("filtering by participating account", func(t *testing.T) {
// we need to add trustlines to filter by account
accountId := keypair.MustRandom().Address()

for _, tl := range []history.TrustLine{
assert.NoError(t, q.UpsertTrustLines(tt.Ctx, []history.TrustLine{
history.MakeTestTrustline(accountId, nativeAsset, ""),
history.MakeTestTrustline(accountId, eurAsset, ""),
history.MakeTestTrustline(accountId, xdr.Asset{}, lp1.PoolID),
} {
err = q.UpsertTrustLines(tt.Ctx, []history.TrustLine{tl})
assert.NoError(t, err)
}
}))

request := makeRequest(
t,
Expand All @@ -166,7 +162,9 @@ func TestGetLiquidityPools(t *testing.T) {
response, err := handler.GetResourcePage(httptest.NewRecorder(), request)
assert.NoError(t, err)
assert.Len(t, response, 1)

assert.IsType(t, protocol.LiquidityPool{}, response[0])
resource = response[0].(protocol.LiquidityPool)
assert.Equal(t, resource.ID, lp1.PoolID)
assert.Equal(t, lp1.PoolID, resource.ID)
})
}

0 comments on commit 5d3ebf8

Please sign in to comment.