fix(warehouse): allow platform resource scope

This commit is contained in:
2026-08-10 16:34:11 +08:00
parent 59a4eb8ed5
commit 074a95d82b
2 changed files with 16 additions and 2 deletions
@@ -35,6 +35,20 @@ import static org.mockito.Mockito.when;
class LocationResourceServiceTest {
@MockBean private LocationRepository repository;
@Resource private LocationResourceService service;
@Test
void supportsPlatformScopedWarehouseResourceQueries() {
WarehouseEntity platformWarehouse = warehouse();
platformWarehouse.setTenantId(0L);
when(repository.findWarehouse(0L, 88L)).thenReturn(platformWarehouse);
when(repository.findAvailable(0L, 88L, 10)).thenReturn(List.of());
when(repository.findReservationsByBusiness(0L, "firstleg-service", 901L)).thenReturn(List.of());
when(repository.findOccupanciesByBusiness(0L, "firstleg-service", 901L)).thenReturn(List.of());
assertThat(service.findAvailable(0L, 88L, 10)).isEmpty();
assertThat(service.findActiveResources(0L, "firstleg-service", 901L)).isEmpty();
}
@Test
void shouldHandleCase01() {
when(repository.findWarehouse(10001L, 88L)).thenReturn(warehouse());