Skip to content

Commit

Permalink
nextcloudgh-10645 Simple unit test for hasExcludePrefix
Browse files Browse the repository at this point in the history
Signed-off-by: Jarno Rankinen <[email protected]>
  • Loading branch information
0ranki committed Jan 18, 2025
1 parent 7806344 commit 7533433
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.owncloud.android.AbstractIT
import com.owncloud.android.datamodel.MediaFolder
import com.owncloud.android.datamodel.MediaFolderType
import com.owncloud.android.datamodel.SyncedFolder
import com.owncloud.android.utils.SyncedFolderUtils.hasExcludePrefix
import org.apache.commons.io.FileUtils
import org.junit.AfterClass
import org.junit.Assert
Expand Down Expand Up @@ -205,6 +206,21 @@ class SyncedFolderUtilsTest : AbstractIT() {
Assert.assertFalse(SyncedFolderUtils.isQualifyingMediaFolder(folder))
}

@Test
fun testInstantUploadPathIgnoreExcludedPrefixes() {
val testFiles = listOf(
"IMG_nnn.jpg",
"my_documents",
"Music",
".trashed_IMG_nnn.jpg",
".pending_IMG_nnn.jpg",
".nomedia",
".thumbdata_IMG_nnn",
".thumbnail"
).filter { !hasExcludePrefix(it) }
Assert.assertTrue(testFiles.size == 3)
}

companion object {
private const val SELFIE = "selfie.png"
private const val SCREENSHOT = "screenshot.JPG"
Expand Down

0 comments on commit 7533433

Please sign in to comment.