From 94ace9b0eb36a2b22aa78e57c6fa4f2edf3e22a3 Mon Sep 17 00:00:00 2001 From: Dmytro Iakymenko Date: Thu, 9 Feb 2023 19:25:36 +0200 Subject: [PATCH] test: updated epochDetailsInRange query --- .../src/example_queries/epochs/epochDetailsInRange.graphql | 5 +++-- packages/api-cardano-db-hasura/test/epochs.query.test.ts | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/api-cardano-db-hasura/src/example_queries/epochs/epochDetailsInRange.graphql b/packages/api-cardano-db-hasura/src/example_queries/epochs/epochDetailsInRange.graphql index 1685e206..3d4f45d2 100644 --- a/packages/api-cardano-db-hasura/src/example_queries/epochs/epochDetailsInRange.graphql +++ b/packages/api-cardano-db-hasura/src/example_queries/epochs/epochDetailsInRange.graphql @@ -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, diff --git a/packages/api-cardano-db-hasura/test/epochs.query.test.ts b/packages/api-cardano-db-hasura/test/epochs.query.test.ts index a0363f94..c7d29986 100644 --- a/packages/api-cardano-db-hasura/test/epochs.query.test.ts +++ b/packages/api-cardano-db-hasura/test/epochs.query.test.ts @@ -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]) })