Added test for reverse

This commit is contained in:
Aaron Cox
2024-01-30 09:30:19 -08:00
parent 75e5ad7864
commit ea2521ea7a
2 changed files with 29 additions and 0 deletions
@@ -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
View File
@@ -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', () => {