Skip to content

Commit

Permalink
fix: Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Apr 3, 2024
1 parent 60c4eac commit f22449a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/tests/ports/catalog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
)
})
})

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tests/ports/trendings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f22449a

Please sign in to comment.