Skip to content

Commit

Permalink
Added failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jun 23, 2023
1 parent c45acae commit 57861c3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/tests/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const mockClient = makeClient('https://eos.greymass.com')
suite('Table', () => {
let nameBidTable
let decentiumTrendingTable
let producersTable

setup(async function () {
nameBidTable = new Table({
Expand All @@ -17,6 +18,12 @@ suite('Table', () => {
client: mockClient,
})

producersTable = new Table({
contract: 'eosio',
name: 'producers',
client: mockClient,
})

decentiumTrendingTable = new Table({
contract: 'decentiumorg',
name: 'trending',
Expand Down Expand Up @@ -114,6 +121,33 @@ suite('Table', () => {
extensions: [],
})
})
test('should fetch table row correctly with default filtering', async () => {
// curl http://eos.greymass.com/v1/chain/get_table_rows -d '{"table":"producers","limit":10,"code":"eosio","scope":"eosio","json":true, "lower_bound": "teamgreymass", "upper_bound": "teamgreymass"}'
const row = await producersTable.find({owner: 'teamgreymass'})

assert.deepEqual(row, {
owner: 'teamgreymass',
total_votes: '9899236489925054464.00000000000000000',
producer_key: 'EOS5ktvwSdLEdusdRn7NmdV2Xu89xiXjir7EhJuZ4DUa8WMNuojbx',
is_active: 1,
url: 'https://greymass.com',
unpaid_blocks: 0,
last_claim_time: '2023-06-23T14:57:10.000',
location: 124,
producer_authority: [
'block_signing_authority_v0',
{
threshold: 1,
keys: [
{
key: 'EOS5ktvwSdLEdusdRn7NmdV2Xu89xiXjir7EhJuZ4DUa8WMNuojbx',
weight: 1,
},
],
},
],
})
})
})

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

0 comments on commit 57861c3

Please sign in to comment.