package pl.firmatpp.kierowca.domain

import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test

class OtpCodeExtractorTest {
    @Test
    fun extractsFourToTenDigitOtpFromSmsBody() {
        assertEquals("1234", OtpCodeExtractor.extract("Kod TPP: 1234"))
        assertEquals("987654", OtpCodeExtractor.extract("Twoj kod weryfikacyjny to 987654."))
        assertEquals("1234567890", OtpCodeExtractor.extract("Code 1234567890"))
    }

    @Test
    fun ignoresNumbersThatAreTooShortOrTooLong() {
        assertNull(OtpCodeExtractor.extract("Kod 123"))
        assertNull(OtpCodeExtractor.extract("Kod 12345678901"))
    }
}
