Skip to content

Commit

Permalink
Added test for reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jan 30, 2024
1 parent 75e5ad7 commit ea2521e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/data/requests/74068b42051d704bf454c567035d80e7be11dfaf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"request": {
"path": "https://eos.greymass.com/v1/chain/get_table_rows",
"params": {
"method": "POST",
"body": "{\"json\":false,\"limit\":1000,\"table\":\"trending\",\"code\":\"decentiumorg\",\"scope\":\"decentiumorg\",\"key_type\":\"i64\",\"lower_bound\":\"5\",\"upper_bound\":\"6\",\"reverse\":true}"
}
},
"status": 200,
"json": {
"rows": [
"06000000000000000895010000000000104d76cca58c6534ca009b2e9baba662bfbfed5c000000006c958ee2037f9a9c039e4c50d4f9473dc7972fa19a2808d37d988f24cba96d0ff3b41474754673da3801598bc003cc70fbcc0a5dfc134b91db86ecbae70d497fd2f2e8bc32e31aa1aaee41c4e61d010000000000000000000000000000",
"05000000000000004190010000000000a02ecd5845b73055a02ecd5845b730557d41ec5c000090dae5a9904a039c9e9903de1a09302017b9bbe1ba8aec85617dd6513aaf4bc65e5e1e3663be34cd9cfaac00010000000000000000000000000000"
],
"more": false,
"next_key": ""
},
"text": "{\"rows\":[\"06000000000000000895010000000000104d76cca58c6534ca009b2e9baba662bfbfed5c000000006c958ee2037f9a9c039e4c50d4f9473dc7972fa19a2808d37d988f24cba96d0ff3b41474754673da3801598bc003cc70fbcc0a5dfc134b91db86ecbae70d497fd2f2e8bc32e31aa1aaee41c4e61d010000000000000000000000000000\",\"05000000000000004190010000000000a02ecd5845b73055a02ecd5845b730557d41ec5c000090dae5a9904a039c9e9903de1a09302017b9bbe1ba8aec85617dd6513aaf4bc65e5e1e3663be34cd9cfaac00010000000000000000000000000000\"],\"more\":false,\"next_key\":\"\"}"
}
10 changes: 10 additions & 0 deletions test/tests/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ suite('Table', () => {
assert.equal(rowsSellTxtScope.length, 348)
})
})

test('reverse', async function () {
const tableRowCursor = decentiumTrendingTable.query({from: 5, to: 6, reverse: true})
tableRowCursor.reset()

assert.deepEqual(
Serializer.objectify(await tableRowCursor.next()).map((row) => row.id),
[6, 5]
)
})
})

suite('get', () => {
Expand Down

0 comments on commit ea2521e

Please sign in to comment.