package tech.easyflow.admin.controller.ai;

import org.testng.Assert;
import org.testng.annotations.Test;
import tech.easyflow.ai.service.PluginService;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * {@link PluginController} 删除接口测试。
 */
public class PluginControllerTest {

    /**
     * 插件删除接口必须委托事务服务执行完整引用校验和删除。
     */
    @Test
    public void removeShouldDelegateToTransactionalService() {
        PluginService pluginService = mock(PluginService.class);
        when(pluginService.removePlugin("10")).thenReturn(true);
        PluginController controller = new PluginController(pluginService);

        boolean removed = controller.removePlugin("10").getData();

        Assert.assertTrue(removed);
        verify(pluginService).removePlugin("10");
    }
}
