Fix failing tests

This commit is contained in:
CalebK 2024-11-12 13:07:51 +03:00 committed by Kelson
parent cff3901491
commit d9cba86579

View File

@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.core.settings
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.io.File import java.io.File
@ -37,14 +38,14 @@ internal class StorageCalculatorTest {
} }
@Test @Test
fun `calculate total space of existing file`() { fun `calculate total space of existing file`() = runTest {
every { file.totalSpace } returns 1 every { file.totalSpace } returns 1
every { file.exists() } returns true every { file.exists() } returns true
assertThat(storageCalculator.calculateTotalSpace(file)).isEqualTo("1 Bytes") assertThat(storageCalculator.calculateTotalSpace(file)).isEqualTo("1 Bytes")
} }
@Test @Test
fun `calculate total space of non existing file`() { fun `calculate total space of non existing file`() = runTest {
every { file.exists() } returns false every { file.exists() } returns false
assertThat(storageCalculator.calculateTotalSpace(file)).isEqualTo("0 Bytes") assertThat(storageCalculator.calculateTotalSpace(file)).isEqualTo("0 Bytes")
} }