Skip to content

Commit 94ace9b

Browse files
committed
test: updated epochDetailsInRange query
1 parent a5bbb05 commit 94ace9b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/api-cardano-db-hasura/src/example_queries/epochs/epochDetailsInRange.graphql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
query epochDetailsInRange (
2-
$numbers: [Int!]
2+
$from: Int!,
3+
$to: Int!
34
) {
4-
epochs( where: { number: { _in: $numbers }}) {
5+
epochs( where: { number: {_gte: $from, _lte: $to } } ) {
56
adaPots {
67
deposits,
78
fees,

packages/api-cardano-db-hasura/test/epochs.query.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ describe('epochs', () => {
7272
})
7373

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

0 commit comments

Comments
 (0)