🧪 Refactor unit tests for executeSearch to separate query setting and result clearing logic

This commit is contained in:
2026-01-29 03:18:47 +00:00
parent 5bfe7c6078
commit 069ac1cea2

View File

@@ -255,14 +255,15 @@ describe('useGamemasterSearch', () => {
});
describe('executeSearch', () => {
it('should set search query and trigger search', async () => {
await composable.executeSearch('test');
it('should set search query', async () => {
composable.executeSearch('test');
expect(composable.searchQuery.value).toBe('test');
});
it('should clear results for empty query', async () => {
it('should clear results when passing empty query', async () => {
composable.searchResults.value = [0, 1, 2];
await composable.executeSearch('');
composable.searchQuery.value = '';
composable.clearSearchResults();
expect(composable.searchResults.value).toEqual([]);
});
});