package com.yaoyicloud.ai.pipeline.fc;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import com.aliyun.fc.runtime.Context;

@RunWith(MockitoJUnitRunner.class)
public class MimicRealMsgHandlerTest {

    @Mock
    private Context context;

    private MimicRealMsgHandler handler;

    @Before
    public void setUp() {
        handler = new MimicRealMsgHandler();
    }

    @Test
    public void testHandleRequest() {
        OssTestDataSet request = new OssTestDataSet(List.of("ossFile1", "ossFile2"));

        TaskContentMsgs response = handler.handleRequest(request, context);

        assertNotNull(response);
        assertEquals(2, response.getItems().size());

        TaskContentMsgs.Message msg1 = response.getItems().get(0);
        assertEquals("testTask1", msg1.getTaskId());
        assertEquals("testUser1", msg1.getUserId());
        assertEquals(List.of("ossFile1"), msg1.getImgList());

        TaskContentMsgs.Message msg2 = response.getItems().get(1);
        assertEquals("testTask1", msg2.getTaskId());
        assertEquals("testUser1", msg2.getUserId());
        assertEquals(List.of("ossFile2"), msg2.getImgList());
    }

}
