package thb.jeanluc.adventure.io;

import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.StringReader;

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

class ConsoleIOSettingsTest {

    @Test
    void colorSetterTogglesAnsiEmission() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ConsoleIO io = new ConsoleIO(new BufferedReader(new StringReader("")),
                new PrintStream(out), ConsoleIO.ColorMode.OFF, ConsoleIO.GlyphMode.UNICODE);
        io.setColorMode(ConsoleIO.ColorMode.ON);
        io.print(thb.jeanluc.adventure.io.text.StyledText.builder().heading("Hi").build());
        assertThat(out.toString()).contains("["); // ANSI escape present
    }
}
