Revision control
Copy as Markdown
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
package org.mozilla.tv.firefox.ext
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Ignore
import org.junit.Test
class StringKtTest {
@Test
fun `WHEN youtube TV pages are entered THEN it is a youtube TV uri`() {
arrayOf(
"https://www.youtube.com/tv#/watch/video/idle?v=Q8TGx71PVgQ&list=RDQ8TGx71PVgQ&resume" // video page
).forEach {
assertTrue(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN youtube TV with capitals pages are entered THEN it is a youtube TV uri`() {
arrayOf(
).forEach {
assertTrue(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN a youtube TV string contains leading or trailing spaces THEN it is a youtube TV uri`() {
arrayOf(
).forEach {
assertTrue(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN tv dot youtube pages are entered THEN it is not a youtube TV uri`() {
arrayOf(
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN youtube desktop pages are entered THEN it is not a youtube TV uri`() {
arrayOf(
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN youtube mobile pages are entered THEN it is not a youtube TV uri`() {
arrayOf(
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN non-youtube pages are entered THEN it is not a youtube TV uri`() {
arrayOf(
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
@Test
fun `WHEN bad urls are entered THEN it is not a youtube TV uri`() {
arrayOf(
"",
" ",
"not-a-uri"
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
@Ignore("this fails. We should fix it by moving to the Uri class.")
@Test
fun `WHEN non youtube TV uris containing youtube tv uri str are entered THEN it is not a youtube TV uri`() {
arrayOf(
).forEach {
assertFalse(it, it.isUriYouTubeTV)
}
}
}