diff --git a/apps/whale-api/src/module.api/address.controller.e2e.ts b/apps/whale-api/src/module.api/address.controller.e2e.ts index d9c80b7727..c43bdc43c2 100644 --- a/apps/whale-api/src/module.api/address.controller.e2e.ts +++ b/apps/whale-api/src/module.api/address.controller.e2e.ts @@ -8,6 +8,7 @@ import { Testing } from '@defichain/jellyfish-testing' import { ForbiddenException } from '@nestjs/common' import BigNumber from 'bignumber.js' import { RegTestFoundationKeys } from '@defichain/jellyfish-network' +import { RpcApiError } from '@defichain/jellyfish-api-core/dist/index' const container = new MasterNodeRegTestContainer() let app: NestFastifyApplication @@ -1077,7 +1078,15 @@ describe('listTokens', () => { }) it('should return empty and page undefined while listTokens with invalid address', async () => { - const tokens = await controller.listTokens('invalid', { size: 30 }) - expect(tokens).toStrictEqual(expect.objectContaining({ data: [], page: undefined })) + try { + await controller.listTokens('invalid', { size: 30 }) + } catch (err) { + expect(err).toBeInstanceOf(RpcApiError) + expect(err.payload).toStrictEqual({ + code: -5, + message: 'Invalid owner address', + method: 'getaccount' + }) + } }) }) diff --git a/apps/whale-api/src/module.api/address.controller.spec.ts b/apps/whale-api/src/module.api/address.controller.spec.ts index c9e0bdaa39..2ed094c846 100644 --- a/apps/whale-api/src/module.api/address.controller.spec.ts +++ b/apps/whale-api/src/module.api/address.controller.spec.ts @@ -5,6 +5,7 @@ import { Testing } from '@defichain/jellyfish-testing' import BigNumber from 'bignumber.js' import { createTestingApp, stopTestingApp } from '../e2e.module' import { NestFastifyApplication } from '@nestjs/platform-fastify' +import { RpcApiError } from '@defichain/jellyfish-api-core/dist/index' const container = new MasterNodeRegTestContainer() const testing = Testing.create(container) @@ -175,7 +176,15 @@ describe('listTokens', () => { }) it('should return empty and page undefined while listTokens with invalid address', async () => { - const tokens = await controller.listTokens('invalid', { size: 30 }) - expect(tokens).toStrictEqual(expect.objectContaining({ data: [], page: undefined })) + try { + await controller.listTokens('invalid', { size: 30 }) + } catch (err) { + expect(err).toBeInstanceOf(RpcApiError) + expect(err.payload).toStrictEqual({ + code: -5, + message: 'Invalid owner address', + method: 'getaccount' + }) + } }) })