aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
index 62b7cac2..79d5ea64 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
@@ -1,7 +1,10 @@
package com.pitchedapps.frost.facebook
+import com.pitchedapps.frost.utils.isImageUrl
import org.junit.Test
import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
/**
@@ -57,4 +60,28 @@ class FbUrlTest {
assertFbFormat(expected, url)
}
+
+ @Test
+ fun imageRegex() {
+ arrayOf(
+ "https://scontent-yyz1-1.xx.fbcdn.net/v/t1.0-9/fr/cp0/e15/q65/229_546131_836546862_n.jpg?efg=e343J9&oh=d4245b1&oe=5453",
+ "/photo/view_full_size/?fbid=1523&ref_component=mbasic_photo_permalink&ref_page=%2Fwap%2Fphoto.php&refid=153&_ft_=...",
+ "#!/photo/view_full_size/?fbid=1523&ref_component=mbasic_photo_permalink&ref_page=%2Fwap%2Fphoto.php&refid=153&_ft_=..."
+ ).forEach {
+ assertTrue(it.isImageUrl, "Failed to match image for $it")
+ }
+ }
+
+ @Test
+ fun antiImageRegex() {
+ arrayOf(
+ "http...fbcdn.net...mp4",
+ "/photo/...png",
+ "https://www.google.ca"
+ ).forEach {
+ assertFalse(it.isImageUrl, "Should not have matched image for $it")
+ }
+
+ }
+
} \ No newline at end of file