package org.raddatz.familienarchiv;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.testcontainers.containers.PostgreSQLContainer;
import software.amazon.awssdk.services.s3.S3Client;

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

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@ActiveProfiles("test")
@Import(PostgresContainerConfig.class)
class ApplicationContextTest {

    @MockitoBean
    S3Client s3Client;

    @Autowired
    ApplicationContext ctx;

    @Test
    void contextLoads() {
        // verifies that the Spring context starts successfully with all beans wired,
        // Flyway migrations applied, and no configuration errors
    }

    @Test
    void sentry_is_disabled_when_no_dsn_is_configured() {
        // application-test.yaml has no sentry.dsn — SDK must stay inactive so tests are clean
        assertThat(io.sentry.Sentry.isEnabled()).isFalse();
    }
}
