diff --git a/tests/snippets.tests.ts b/tests/snippets.tests.ts index bb44ffa2..a2962e01 100644 --- a/tests/snippets.tests.ts +++ b/tests/snippets.tests.ts @@ -308,3 +308,21 @@ describe('Snippet Browser test', () => { } }) }) + +test('Test attributes to snippet on value smaller than the snippet size', async () => { + const response = await searchClient.search([ + { + indexName: 'movies', + params: { + query: '', + attributesToSnippet: ['*:20'], + snippetEllipsisText: '...', + }, + }, + ]) + const hit = response.results[0].hits[0]._snippetResult + + if (hit?.overview) { + expect(hit?.title?.value).toEqual('Star Wars') + } +})