package space.nstart.pcp.tle_monitoring_service.service

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when`
import space.nstart.pcp.tle_monitoring_service.repository.TLERepository

class SatelliteDeletedServiceTest {

    @Test
    fun `deleteSatelliteData removes TLE rows`() {
        val tleRepository = mock(TLERepository::class.java)
        val service = SatelliteDeletedService(tleRepository)

        `when`(tleRepository.countBySatelliteId(56756L)).thenReturn(4L)
        `when`(tleRepository.deleteAllBySatelliteId(56756L)).thenReturn(4L)

        val deleted = service.deleteSatelliteData(56756L)

        assertEquals(4L, deleted)
        verify(tleRepository).countBySatelliteId(56756L)
        verify(tleRepository).deleteAllBySatelliteId(56756L)
    }
}
