From d9975787776bc02331e9be3f9c27d54b950bf454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hector=20G=C3=B3mez=20Varela?= Date: Thu, 22 Feb 2024 15:59:42 +0100 Subject: [PATCH] Fix Zerion getCollectibles items count attribute --- .../balances-api/zerion-balances-api.service.ts | 4 ++-- .../controllers/zerion-collectibles.controller.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/datasources/balances-api/zerion-balances-api.service.ts b/src/datasources/balances-api/zerion-balances-api.service.ts index cd456b3e0f..cfc633f917 100644 --- a/src/datasources/balances-api/zerion-balances-api.service.ts +++ b/src/datasources/balances-api/zerion-balances-api.service.ts @@ -136,10 +136,10 @@ export class ZerionBalancesApi implements IBalancesApi { expireTimeSeconds: this.defaultExpirationTimeInSeconds, }); - // TODO: Zerion does not provide the items count. Change this value to null when count attribute becomes nullable. + // Zerion does not provide the items count. // Zerion does not provide a "previous" cursor. return { - count: zerionCollectibles.data.length, + count: null, next: this._decodeZerionPagination(zerionCollectibles.links.next ?? ''), previous: null, results: this._mapCollectibles(zerionCollectibles.data), diff --git a/src/routes/collectibles/__tests__/controllers/zerion-collectibles.controller.spec.ts b/src/routes/collectibles/__tests__/controllers/zerion-collectibles.controller.spec.ts index 68c3c118b3..417d5073de 100644 --- a/src/routes/collectibles/__tests__/controllers/zerion-collectibles.controller.spec.ts +++ b/src/routes/collectibles/__tests__/controllers/zerion-collectibles.controller.spec.ts @@ -142,7 +142,7 @@ describe('Zerion Collectibles Controller', () => { .expect(200) .expect(({ body }) => { expect(body).toMatchObject({ - count: zerionApiCollectiblesResponse.data.length, + count: null, next: expect.any(String), previous: null, results: [ @@ -282,7 +282,7 @@ describe('Zerion Collectibles Controller', () => { .expect(200) .expect(({ body }) => { expect(body).toMatchObject({ - count: zerionApiCollectiblesResponse.data.length, + count: null, next: expect.stringContaining(expectedNext), previous: null, results: expect.any(Array), @@ -345,7 +345,7 @@ describe('Zerion Collectibles Controller', () => { .expect(200) .expect(({ body }) => { expect(body).toMatchObject({ - count: zerionApiCollectiblesResponse.data.length, + count: null, next: expect.stringContaining(expectedNext), previous: null, results: expect.any(Array), @@ -407,7 +407,7 @@ describe('Zerion Collectibles Controller', () => { .expect(200) .expect(({ body }) => { expect(body).toMatchObject({ - count: zerionApiCollectiblesResponse.data.length, + count: null, next: expect.stringContaining(expectedNext), previous: null, results: expect.any(Array),