Skip to content

Commit

Permalink
add extra test case to TestGetPageQueryCursorDefaultTOID
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Aug 6, 2024
1 parent 9b925b1 commit 78bd59c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions services/horizon/internal/actions/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,25 @@ func TestGetPageQueryCursorDefaultTOID(t *testing.T) {
assert.Equal(t, uint64(2), pq.Limit)
assert.Equal(t, "desc", pq.Order)

ledgerState.SetHorizonStatus(ledger.HorizonStatus{
HistoryLatest: 7000,
HistoryLatestClosedAt: time.Now(),
HistoryElder: 0,
ExpHistoryLatest: 7000,
})

pq, err = GetPageQuery(ledgerState, ascReq, DefaultTOID)
assert.NoError(t, err)
assert.Equal(t, toid.AfterLedger(0).String(), pq.Cursor)
assert.Equal(t, uint64(2), pq.Limit)
assert.Equal(t, "asc", pq.Order)

pq, err = GetPageQuery(ledgerState, descReq, DefaultTOID)
assert.NoError(t, err)
assert.Equal(t, "", pq.Cursor)
assert.Equal(t, uint64(2), pq.Limit)
assert.Equal(t, "desc", pq.Order)

}

func TestGetString(t *testing.T) {
Expand Down

0 comments on commit 78bd59c

Please sign in to comment.