Refactored the FileUtilsInstrumentationTest.

This commit is contained in:
MohitMaliFtechiz 2025-02-10 19:17:57 +05:30 committed by Kelson
parent d974822481
commit 4735933fd5

View File

@ -340,7 +340,7 @@ class FileUtilsInstrumentationTest {
// get the SD card path
val sdCardPath = context?.getExternalFilesDirs("")
?.get(1)?.path?.substringBefore("/Android")
val dummyUriData = listOf(
val dummyUriData = arrayListOf(
// test the download uri on older devices
DummyUrlData(
null,
@ -385,14 +385,6 @@ class FileUtilsInstrumentationTest {
"%3A$commonUri"
)
),
// test with USB stick uri
DummyUrlData(
null,
null,
"/mnt/media_rw/USB/$commonPath",
null,
Uri.parse("${primaryStorageUriPrefix}USB%3A$commonUri")
),
// test with invalid uri
DummyUrlData(
null,
@ -421,6 +413,18 @@ class FileUtilsInstrumentationTest {
)
)
)
// test with USB stick uri
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
dummyUriData.add(
DummyUrlData(
null,
null,
"/mnt/media_rw/USB/$commonPath",
null,
Uri.parse("${primaryStorageUriPrefix}USB%3A$commonUri")
)
)
}
context?.let { context ->
CoroutineScope(Dispatchers.Main).launch {
dummyUriData.forEach { dummyUrlData ->