diff options
author | Allan Wang <me@allanwang.ca> | 2020-03-01 23:00:09 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2020-03-01 23:00:09 -0800 |
commit | e19c87ae367154bd5bbf59f080eee4976e64e2da (patch) | |
tree | 52f30b2d97dee998aabe46feffc1f4999275ec42 /app/src/test/kotlin/com/pitchedapps/frost/facebook | |
parent | 10d6cfdecb790e235e09641b18b4a10a645f87a0 (diff) | |
download | frost-e19c87ae367154bd5bbf59f080eee4976e64e2da.tar.gz frost-e19c87ae367154bd5bbf59f080eee4976e64e2da.tar.bz2 frost-e19c87ae367154bd5bbf59f080eee4976e64e2da.zip |
Format code
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/facebook')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRegexTest.kt | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRegexTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRegexTest.kt index fc96ef2e..08957ea9 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRegexTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRegexTest.kt @@ -27,7 +27,8 @@ class FbRegexTest { @Test fun userIdRegex() { val id = 12349876L - val cookie = "wd=1366x615; c_user=$id; act=1234%2F12; m_pixel_ratio=1; presence=hello; x-referer=asdfasdf" + val cookie = + "wd=1366x615; c_user=$id; act=1234%2F12; m_pixel_ratio=1; presence=hello; x-referer=asdfasdf" assertEquals(id, FB_USER_MATCHER.find(cookie)[1]?.toLong()) } @@ -41,13 +42,17 @@ class FbRegexTest { @Test fun ppRegex() { - val img = "https\\3a //scontent-yyz1-1.xx.fbcdn.net/v/asdf1234.jpg?efg\\3d 333\\26 oh\\3d 77\\26 oe\\3d 444" + val img = + "https\\3a //scontent-yyz1-1.xx.fbcdn.net/v/asdf1234.jpg?efg\\3d 333\\26 oh\\3d 77\\26 oe\\3d 444" val imgUnescaped = StringEscapeUtils.unescapeCsv(img) val ppStyleSingleQuote = "background:#d8dce6 url('$img') no-repeat center;" val ppStyleDoubleQuote = "background:#d8dce6 url(\"$img\") no-repeat center;" val ppStyleNoQuote = "background:#d8dce6 url($img) no-repeat center;" listOf(ppStyleSingleQuote, ppStyleDoubleQuote, ppStyleNoQuote).forEach { - assertEquals(imgUnescaped, StringEscapeUtils.unescapeCsv(FB_CSS_URL_MATCHER.find(it)[1])) + assertEquals( + imgUnescaped, + StringEscapeUtils.unescapeCsv(FB_CSS_URL_MATCHER.find(it)[1]) + ) } } @@ -55,9 +60,17 @@ class FbRegexTest { fun msgNotifIdRegex() { val id = 1273491646093428L val data = "threadlist_row_other_user_fbid_thread_fbid_$id" - assertEquals(id, FB_MESSAGE_NOTIF_ID_MATCHER.find(data)[1]?.toLong(), "thread_fbid mismatch") + assertEquals( + id, + FB_MESSAGE_NOTIF_ID_MATCHER.find(data)[1]?.toLong(), + "thread_fbid mismatch" + ) val userData = "threadlist_row_other_user_fbid_${id}thread_fbid_" - assertEquals(id, FB_MESSAGE_NOTIF_ID_MATCHER.find(userData)[1]?.toLong(), "user_fbid mismatch") + assertEquals( + id, + FB_MESSAGE_NOTIF_ID_MATCHER.find(userData)[1]?.toLong(), + "user_fbid mismatch" + ) } @Test @@ -70,7 +83,8 @@ class FbRegexTest { @Test fun imageIdRegex() { val id = 123456L - val img = "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/89056_${id}_98239_o.jpg" + val img = + "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/89056_${id}_98239_o.jpg" assertEquals(id, FB_IMAGE_ID_MATCHER.find(img)[1]?.toLongOrNull()) } } |