fix: include overlapping overnight FBA appointments in calendar
This commit is contained in:
+19
@@ -25,6 +25,25 @@ import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class FbaAppointmentPersistenceTest {
|
||||
@Test void calendarIncludesOverlappingSlotsButNotAnExclusiveMidnightEnd() {
|
||||
try(var context=new AnnotationConfigApplicationContext(Config.class)) {
|
||||
var service=context.getBean(InboundFbaAppointmentService.class);
|
||||
service.createFromSources("operator",request("overlap"));
|
||||
var db=new JdbcTemplate(context.getBean(DataSource.class));
|
||||
var day=java.time.LocalDate.of(2026,10,15);
|
||||
db.update("UPDATE ll_inbound_fba_appointment SET planned_at='2026-10-14 23:00:00',planned_end_at='2026-10-15 01:00:00'");
|
||||
assertEquals(1,service.calendar(day,day.plusDays(1)).size());
|
||||
db.update("UPDATE ll_inbound_fba_appointment SET planned_end_at='2026-10-15 00:00:00'");
|
||||
assertTrue(service.calendar(day,day.plusDays(1)).isEmpty());
|
||||
db.update("UPDATE ll_inbound_fba_appointment SET appointment_at='2026-10-14 23:00:00',appointment_end_at='2026-10-15 01:00:00'");
|
||||
assertEquals(1,service.calendar(day,day.plusDays(1)).size());
|
||||
db.update("UPDATE ll_inbound_fba_appointment SET appointment_end_at=NULL,planned_end_at='2026-10-16 01:00:00'");
|
||||
assertTrue(service.calendar(day,day.plusDays(1)).isEmpty());
|
||||
db.update("UPDATE ll_inbound_fba_appointment SET appointment_at=NULL,planned_at=NULL,planned_end_at=NULL,planned_date='2026-10-15'");
|
||||
assertEquals(1,service.calendar(day,day.plusDays(1)).size());
|
||||
assertTrue(service.calendar(day.plusDays(1),day.plusDays(2)).isEmpty());
|
||||
}
|
||||
}
|
||||
interface OrderVersionProbe {
|
||||
@org.apache.ibatis.annotations.Select("SELECT version FROM ll_order WHERE id=#{id}")
|
||||
int version(long id);
|
||||
|
||||
Reference in New Issue
Block a user