package org.raddatz.familienarchiv.ocr;

import org.junit.jupiter.api.Test;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.UUID;

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

class OcrProgressServiceTest {

    private final OcrProgressService progressService = new OcrProgressService();

    @Test
    void register_returnsNonNullEmitter() {
        UUID jobId = UUID.randomUUID();
        SseEmitter emitter = progressService.register(jobId);
        assertThat(emitter).isNotNull();
    }

    @Test
    void emit_doesNotThrow_whenNoEmittersRegistered() {
        assertThatCode(() -> progressService.emit(UUID.randomUUID(), "test", "data"))
                .doesNotThrowAnyException();
    }

    @Test
    void complete_doesNotThrow_whenNoEmittersRegistered() {
        assertThatCode(() -> progressService.complete(UUID.randomUUID()))
                .doesNotThrowAnyException();
    }
}
