Skip to content

Commit

Permalink
Merge pull request #1249 from input-output-hk/fix/empty-fuzzy-search
Browse files Browse the repository at this point in the history
fix(cardano-services): stake pool fuzzy search empty result
  • Loading branch information
iccicci committed May 7, 2024
2 parents b4abf94 + aff2cdd commit 6b7dd94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class TypeormStakePoolProvider extends TypeormProvider implements StakePo
[
'DROP TABLE IF EXISTS tmp_fuzzy',
'CREATE TEMPORARY TABLE tmp_fuzzy (pool_id VARCHAR, score NUMERIC) WITHOUT OIDS',
`INSERT INTO tmp_fuzzy VALUES ${values}`
...(values === '' ? [] : [`INSERT INTO tmp_fuzzy VALUES ${values}`])
].join(';')
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,14 @@ describe('TypeormStakePoolProvider', () => {
});
expect(response.pageResults.map(({ metadata }) => metadata?.ticker)).toEqual(['SP11', 'SP10', 'SP1']);
});

it('returns an empty array on empty search result', async () => {
const response = await provider.queryStakePools({
filters: { text: 'no one match this search' },
pagination
});
expect(response.pageResults).toEqual([]);
});
});

describe('stake pools sort', () => {
Expand Down

0 comments on commit 6b7dd94

Please sign in to comment.