mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-10 15:12:12 +00:00
Fix tests to match updated bulk search behavior (no more RuntimeException)
The bulk search service now returns empty response DTOs instead of throwing RuntimeException when no results are found. Updated tests to use assertFalse(hasAnyResults()) instead of catching exceptions.
This commit is contained in:
parent
99148eee76
commit
fe7c94bd72
1 changed files with 6 additions and 14 deletions
|
|
@ -1025,13 +1025,9 @@ final class BulkInfoProviderImportControllerTest extends WebTestCase
|
|||
new BulkSearchFieldMappingDTO('test_supplier_spn', ['test'], 2)
|
||||
];
|
||||
|
||||
// The service should be able to process the request and throw an exception when no results are found
|
||||
try {
|
||||
$bulkService->performBulkSearch([$part], $fieldMappings, false);
|
||||
$this->fail('Expected RuntimeException to be thrown when no search results are found');
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertStringContainsString('No search results found', $e->getMessage());
|
||||
}
|
||||
// The service should return an empty response DTO when no results are found
|
||||
$response = $bulkService->performBulkSearch([$part], $fieldMappings, false);
|
||||
$this->assertFalse($response->hasAnyResults());
|
||||
}
|
||||
|
||||
public function testBulkInfoProviderServiceBatchProcessing(): void
|
||||
|
|
@ -1055,13 +1051,9 @@ final class BulkInfoProviderImportControllerTest extends WebTestCase
|
|||
new BulkSearchFieldMappingDTO('empty', ['test'], 1)
|
||||
];
|
||||
|
||||
// The service should be able to process the request and throw an exception when no results are found
|
||||
try {
|
||||
$response = $bulkService->performBulkSearch([$part], $fieldMappings, false);
|
||||
$this->fail('Expected RuntimeException to be thrown when no search results are found');
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertStringContainsString('No search results found', $e->getMessage());
|
||||
}
|
||||
// The service should return an empty response DTO when no results are found
|
||||
$response = $bulkService->performBulkSearch([$part], $fieldMappings, false);
|
||||
$this->assertFalse($response->hasAnyResults());
|
||||
}
|
||||
|
||||
public function testBulkInfoProviderServicePrefetchDetails(): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue