Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
delete extra code
  • Loading branch information
Elena Moshnikova committed Oct 22, 2024
1 parent f819249 commit 483e0e6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/kotlin/com/epam/brn/service/UserAnalyticsServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.data.domain.Pageable
import java.io.InputStream
import java.time.LocalDateTime

@ExtendWith(MockKExtension::class)
Expand Down Expand Up @@ -240,4 +241,24 @@ internal class UserAnalyticsServiceTest {
metaDataResult.speedFloat shouldBe "0.8"
metaDataResult.speedCode shouldBe AzureRates.SLOW
}

@Test
fun `should prepareAudioStreamForUser`() {
// GIVEN
val studyHistory = mockk<StudyHistory>()
val audioStreamMock = InputStream.nullInputStream()
every { userAccountService.getCurrentUserId() } returns currentUserId
every {
studyHistoryRepository.findLastByUserAccountIdAndExerciseId(currentUserId, exerciseId)
} returns studyHistory
every { exerciseService.isDoneWell(studyHistory) } returns false
every { exerciseRepository.findTypeByExerciseId(exerciseId) } returns ExerciseType.SINGLE_SIMPLE_WORDS.name
val audioFileMetaData = AudioFileMetaData("text", BrnLocale.RU.locale, Voice.FILIPP.name, "1", AzureRates.DEFAULT)
every { textToSpeechService.generateAudioOggStreamWithValidation(audioFileMetaData) } returns audioStreamMock
// WHEN
val audioStreamResult = userAnalyticsService.prepareAudioStreamForUser(exerciseId, audioFileMetaData)

// THEN
audioStreamResult.toString().isNotEmpty()
}
}

0 comments on commit 483e0e6

Please sign in to comment.