From f22449a50af82db85f4da17b5a23cbb68291683d Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio Date: Wed, 3 Apr 2024 15:55:12 -0300 Subject: [PATCH] fix: Tests --- src/tests/ports/catalog.spec.ts | 10 +++++++--- src/tests/ports/trendings.spec.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tests/ports/catalog.spec.ts b/src/tests/ports/catalog.spec.ts index c0902027..210f4ac2 100644 --- a/src/tests/ports/catalog.spec.ts +++ b/src/tests/ports/catalog.spec.ts @@ -96,7 +96,7 @@ test('catalog component', function () { rows: { entity_schema: string }[] rowCount: number } - let network = Network.ETHEREUM + let network: Network.ETHEREUM = Network.ETHEREUM let filters: CatalogFilters let latestSchema = 'sgd1234' let dbItemResponse: CollectionsItemDBResult @@ -336,7 +336,9 @@ test('catalog component', function () { itemIdsBySearchTextQuery ) // It's repeated 7 times due to the SELECT + WHERE statements: `WHERE word_wearable % $1 OR word_emote % $2 ORDER BY GREATEST(similarity(word_wearable, $3), similarity(word_emote, $4)) DESC;` - expect(dbClientQueryMock.mock.calls[1][0].values).toEqual(Array(7).fill(search)) + expect(dbClientQueryMock.mock.calls[1][0].values).toEqual( + Array(7).fill(search) + ) }) }) @@ -383,7 +385,9 @@ test('catalog component', function () { getItemIdsBySearchTextQuery(latestSchema, filters) ) // It's repeated 4 times due to this WHERE statement: `WHERE word_wearable % $1 OR word_emote % $2 ORDER BY GREATEST(similarity(word_wearable, $3), similarity(word_emote, $4)) DESC;` - expect(dbClientQueryMock.mock.calls[1][0].values).toEqual(Array(7).fill(search)) + expect(dbClientQueryMock.mock.calls[1][0].values).toEqual( + Array(7).fill(search) + ) const mainCatalogQuery = getCatalogQuery( { [network]: latestSchema }, { ...filters, ids: [mockedDBItemResponse.id] } // the main query should have the ids returned by the search query diff --git a/src/tests/ports/trendings.spec.ts b/src/tests/ports/trendings.spec.ts index 32928fe0..4a580ab9 100644 --- a/src/tests/ports/trendings.spec.ts +++ b/src/tests/ports/trendings.spec.ts @@ -31,7 +31,7 @@ const getSalesOfSameItem = (qty: number, isOnSale = true) => searchContractAddress: `0xsameItemSale${qty}${isOnSale ? 'onSale' : ''}`, })) -const getItem = (contractAddress: string, itemId: string) => ({ +const getItem = (contractAddress: string, itemId: string): Item => ({ id: `${contractAddress}-${itemId}`, name: 'mockdItem', thumbnail: