From 582eacf067b8d35f214c1e0285203aab19ddea20 Mon Sep 17 00:00:00 2001 From: amateima <89395931+amateima@users.noreply.github.com> Date: Mon, 30 Jan 2023 16:55:24 +0200 Subject: [PATCH] fix: /deposits, exclude pending deposits with amount 0 (#212) * fix: /deposits, exclude pending deposits with amount 0 * Fix * Fix tests * Update service.ts --- src/modules/deposit/service.ts | 1 + test/deposit.e2e-spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/deposit/service.ts b/src/modules/deposit/service.ts index b577c0ef..c71c8984 100644 --- a/src/modules/deposit/service.ts +++ b/src/modules/deposit/service.ts @@ -97,6 +97,7 @@ export class DepositService { [deposits, total] = await this.depositRepository .createQueryBuilder("d") .where("d.status = :status", { status }) + .andWhere("d.amount > 0") .andWhere("d.depositDate > NOW() - INTERVAL '1 days'") .andWhere(`d.depositRelayerFeePct * :multiplier >= d.suggestedRelayerFeePct`, { multiplier: this.appConfig.values.suggestedFees.deviationBufferMultiplier, diff --git a/test/deposit.e2e-spec.ts b/test/deposit.e2e-spec.ts index 8fd293a7..803eed7e 100644 --- a/test/deposit.e2e-spec.ts +++ b/test/deposit.e2e-spec.ts @@ -25,12 +25,12 @@ describe("GET /deposits", () => { // filled deposits with depositIds 10 - 19 and ascending depositDate const FILLED_DEPOSITS = mockManyDepositEntities(10, { depositIdStartIndex: 10, - overrides: { status: "filled", depositorAddr: depositorAddress }, + overrides: { status: "filled", depositorAddr: depositorAddress, amount: "10", filled: "10" }, }); // pending deposits with depositIds 20 - 29 and ascending depositDate const PENDING_DEPOSITS = mockManyDepositEntities(10, { depositIdStartIndex: 20, - overrides: { status: "pending", depositorAddr: depositorAddress }, + overrides: { status: "pending", depositorAddr: depositorAddress, amount: "10" }, }); beforeAll(async () => {