From d2543a2793e68e6ffa6e80c78d17c7b2f9dd8c1d Mon Sep 17 00:00:00 2001 From: Olha Zakharova Date: Thu, 6 Jul 2023 23:04:44 -0400 Subject: [PATCH] fix: tests --- server/models/Wallet.spec.js | 12 ++++++++---- server/repositories/WalletRepository.spec.js | 13 +++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/server/models/Wallet.spec.js b/server/models/Wallet.spec.js index d8d8e099..9f1c197c 100644 --- a/server/models/Wallet.spec.js +++ b/server/models/Wallet.spec.js @@ -137,10 +137,14 @@ describe('Wallet Model', () => { }); expect(result).eql([{ id: walletId, wallet }]); - expect(walletRepositoryStub.getAllWallets).calledOnceWithExactly(walletId, { - limit: 1, - offset: 1, - }); + expect(walletRepositoryStub.getAllWallets).calledOnceWithExactly( + walletId, + { + limit: 1, + offset: 1, + }, + '', + ); }); describe('hasControlOver function', async () => { diff --git a/server/repositories/WalletRepository.spec.js b/server/repositories/WalletRepository.spec.js index fe404850..592a20f1 100644 --- a/server/repositories/WalletRepository.spec.js +++ b/server/repositories/WalletRepository.spec.js @@ -80,4 +80,17 @@ describe('WalletRepository', () => { const entity = await walletRepository.getAllWallets(uuid.v4()); expect(entity).to.be.a('array'); }); + + it('getAllWalletsCount', async () => { + tracker.uninstall(); + tracker.install(); + tracker.on('query', (query) => { + expect(query.sql).match( + /select.*wallet.*where.*actor_wallet_id.*request_type.*/, + ); + query.response([{ id: 1 }]); + }); + const entity = await walletRepository.getAllWallets(uuid.v4()); + expect(entity).to.be.a('array'); + }); });