package com.sino.mci.channel.wecom;

import com.sino.mci.channel.common.dto.SendMessageRequest;
import com.sino.mci.channel.common.dto.SendMessageResult;
import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.*;

class WeComBotSenderTest {

    private final WeComBotSender sender = new WeComBotSender();

    @Test
    void sendRejectsMissingKey() {
        SendMessageRequest request = new SendMessageRequest();
        request.setExtra(null);
        SendMessageResult result = sender.send(request);
        assertFalse(result.isSuccess());
        assertTrue(result.getMessage().contains("webhook key"));
    }

    @Test
    void sendBuildsTextBody() {
        SendMessageRequest request = new SendMessageRequest();
        request.setExtra(Map.of("account_id", "dummy"));
        request.setContentType("text");
        request.setContent(Map.of("text", "hello"));
        // With a real key this hits WeCom; keep as shape validation only.
        assertNotNull(request);
    }
}
