Skip to content

Commit d597c7a

Browse files
committed
Test that ellipsis on smaller values than cropsize are not added
1 parent a4e4546 commit d597c7a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/snippets.tests.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,21 @@ describe('Snippet Browser test', () => {
308308
}
309309
})
310310
})
311+
312+
test('Test attributes to snippet on value smaller than the snippet size', async () => {
313+
const response = await searchClient.search<Movies>([
314+
{
315+
indexName: 'movies',
316+
params: {
317+
query: '',
318+
attributesToSnippet: ['*:20'],
319+
snippetEllipsisText: '...',
320+
},
321+
},
322+
])
323+
const hit = response.results[0].hits[0]._snippetResult
324+
325+
if (hit?.overview) {
326+
expect(hit?.title?.value).toEqual('Star Wars')
327+
}
328+
})

0 commit comments

Comments
 (0)