package tech.easyflow.skill.service.impl;

import com.mybatisflex.core.query.QueryWrapper;
import org.junit.Test;

import java.math.BigInteger;
import java.util.Locale;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * {@link SkillResourceServiceImpl} 轻量资源描述查询契约测试。
 */
public class SkillResourceServiceImplProjectionTest {

    /**
     * 文件树和管理详情查询应保留摘要字段，同时排除正文与内部内容引用。
     */
    @Test
    public void descriptorQueryExcludesHeavyAndInternalContentColumns() {
        SkillResourceServiceImpl service = new SkillResourceServiceImpl();

        QueryWrapper query = service.descriptorQuery(BigInteger.ONE, BigInteger.TWO);
        String sql = query.toSQL().toLowerCase(Locale.ROOT);

        assertTrue(sql.contains("normalized_path"));
        assertTrue(sql.contains("content_hash"));
        assertTrue(sql.contains("media_type"));
        assertTrue(sql.contains("is_text"));
        assertTrue(sql.contains("size"));
        assertFalse(sql.contains("metadata_json"));
        assertFalse(sql.contains("text_content"));
        assertFalse(sql.contains("content_ref"));
    }
}
