From 4735933fd5156aa22b7c1ece99994da024fc0cc8 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 10 Feb 2025 19:17:57 +0530 Subject: [PATCH] Refactored the FileUtilsInstrumentationTest. --- .../files/FileUtilsInstrumentationTest.kt | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/utils/files/FileUtilsInstrumentationTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/utils/files/FileUtilsInstrumentationTest.kt index 801828e2a..84778ba30 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/utils/files/FileUtilsInstrumentationTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/utils/files/FileUtilsInstrumentationTest.kt @@ -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 ->