package tech.easyflow.ai.easyagentsflow.upload;

import org.junit.Test;
import org.mockito.Mockito;

/**
 * {@link WorkflowApiUploadCleanupScheduler} 批量排空测试。
 */
public class WorkflowApiUploadCleanupSchedulerTest {

    /**
     * 验证一次调度会连续处理多批到期记录。
     */
    @Test
    public void cleanupShouldDrainMultipleBatches() {
        WorkflowApiUploadLifecycleService lifecycleService =
                Mockito.mock(WorkflowApiUploadLifecycleService.class);
        Mockito.when(lifecycleService.cleanupExpired(100))
                .thenReturn(100, 100, 20);
        WorkflowApiUploadCleanupScheduler scheduler =
                new WorkflowApiUploadCleanupScheduler(lifecycleService);

        scheduler.cleanup();

        Mockito.verify(lifecycleService, Mockito.times(3))
                .cleanupExpired(100);
    }
}
