Skip to content

Commit

Permalink
test: updated epochDetailsInRange query
Browse files Browse the repository at this point in the history
  • Loading branch information
iadmytro authored and rhyslbw committed Feb 13, 2023
1 parent 2284df5 commit a8587dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
query epochDetailsInRange (
$numbers: [Int!]
$from: Int!,
$to: Int!
) {
epochs( where: { number: { _in: $numbers }}) {
epochs( where: { number: {_gte: $from, _lte: $to } } ) {
adaPots {
deposits,
fees,
Expand Down
5 changes: 2 additions & 3 deletions packages/api-cardano-db-hasura/test/epochs.query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ describe('epochs', () => {
})

it('Returns epoch details by number range', async () => {
// Todo: Convert this into an actual ranged query now the performance issue is resolved.
// TODO: how to convert ???
const dbResp = await db.query('SELECT max(epoch_no) AS epoch_no FROM block;')
const result = await client.query({
query: await loadQueryNode('epochDetailsInRange'),
variables: { numbers: [dbResp.rows[0].epoch_no] }
variables: { from: dbResp.rows[0].epoch_no - 2, to: dbResp.rows[0].epoch_no }
})
expect(result.data.epochs.length).toEqual(3)
allFieldsPopulated(result.data.epochs[0])
})

Expand Down

0 comments on commit a8587dc

Please sign in to comment.