package thb.jeanluc.adventure.loader;

import org.junit.jupiter.api.Test;
import thb.jeanluc.adventure.loader.dto.ConditionDto;
import thb.jeanluc.adventure.loader.dto.EndingDto;
import thb.jeanluc.adventure.model.Ending;

import java.util.List;

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

class EndingLoadingTest {
    @Test
    void factoryMapsFields() {
        Ending e = EndingFactory.fromDto(new EndingDto("victory", "Won", true,
                List.of(new ConditionDto("manor_secured", null, null)), "You win."));
        assertThat(e.id()).isEqualTo("victory");
        assertThat(e.victory()).isTrue();
        assertThat(e.when()).hasSize(1);
        assertThat(e.text()).isEqualTo("You win.");
    }
}
