package thb.jeanluc.adventure.command;

import org.junit.jupiter.api.Test;

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

class CommandParserTest {

    private final CommandParser parser = new CommandParser();

    @Test
    void parse_blankInput_yieldsEmptyVerb() {
        assertThat(parser.parse("").verb()).isEmpty();
        assertThat(parser.parse("   ").verb()).isEmpty();
        assertThat(parser.parse(null).verb()).isEmpty();
    }

    @Test
    void parse_lowercases() {
        ParsedCommand p = parser.parse("Go NORTH");
        assertThat(p.verb()).isEqualTo("go");
        assertThat(p.args()).containsExactly("north");
    }

    @Test
    void parse_dropsFillers() {
        ParsedCommand p = parser.parse("go to the north");
        assertThat(p.verb()).isEqualTo("go");
        assertThat(p.args()).containsExactly("north");
    }

    @Test
    void parse_giveItemToNpc_keepsBoth() {
        ParsedCommand p = parser.parse("give lamp to old_man");
        assertThat(p.verb()).isEqualTo("give");
        assertThat(p.args()).containsExactly("lamp", "old_man");
    }
}
