package cn.yunzhixue.ability.center.examsprint.infrastructure.report.rendering.achievement;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

class AchievementExamSprintReportSvgChartBuilderTest {

    @Test
    void comparisonBarChartKeepsTinyPositiveBarsProportionalToAxisScale() {
        AchievementExamSprintReportSvgChartBuilder builder = new AchievementExamSprintReportSvgChartBuilder();

        String svg = builder.comparisonBarChart(
                "vocabulary-growth-chart",
                "词汇量对比",
                "训练前",
                1,
                "1 词",
                "训练后",
                1000,
                "1000 词",
                "#ff7d00");

        assertThat(svg)
                .contains("<rect class='chart-bar chart-bar-before' x='118' y='180' width='58' height='0' rx='10' ry='10' fill='#9fb3c8'/>")
                .contains("<rect class='chart-bar chart-bar-after' x='222' y='36' width='58' height='144' rx='10' ry='10' fill='#ff7d00'/>")
                .doesNotContain("<rect class='chart-bar chart-bar-before' x='118' y='162' width='58' height='18'");
    }
}
