package org.raddatz.familienarchiv.document.transcription;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
class TranscriptionBlockQueryServiceTest {

    @Mock TranscriptionBlockRepository blockRepository;
    @InjectMocks TranscriptionBlockQueryService queryService;

    @Test
    void hasBlocks_returns_true_when_a_block_exists() {
        UUID documentId = UUID.randomUUID();
        when(blockRepository.existsByDocumentId(documentId)).thenReturn(true);

        assertThat(queryService.hasBlocks(documentId)).isTrue();
    }

    @Test
    void hasBlocks_returns_false_when_no_block_exists() {
        UUID documentId = UUID.randomUUID();
        when(blockRepository.existsByDocumentId(documentId)).thenReturn(false);

        assertThat(queryService.hasBlocks(documentId)).isFalse();
    }
}
