-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure only the protocol scheme is lowercase
- Loading branch information
Showing
2 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...roid-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/TextUtilsKtTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.getstream.chat.android.compose.ui.util | ||
|
||
import org.amshove.kluent.`should be equal to` | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
|
||
internal class TextUtilsKtTest { | ||
|
||
@ParameterizedTest | ||
@MethodSource("urlArguments") | ||
fun `Verify that only the scheme should be lowercase`( | ||
url: String, | ||
schemes: List<String>, | ||
expectedResult: String | ||
) { | ||
url.ensureLowercaseScheme(schemes) `should be equal to` expectedResult | ||
} | ||
|
||
companion object { | ||
|
||
@JvmStatic | ||
fun urlArguments() = listOf( | ||
Arguments.of( | ||
"http://www.getstream.io", | ||
listOf("https://", "http://"), | ||
"http://www.getstream.io", | ||
), | ||
Arguments.of( | ||
"https://www.getstream.io", | ||
listOf("https://", "http://"), | ||
"https://www.getstream.io", | ||
), | ||
Arguments.of( | ||
"HTTPS://www.getstream.io", | ||
listOf("https://", "http://"), | ||
"https://www.getstream.io", | ||
), | ||
Arguments.of( | ||
"HTtPS://www.getstream.io", | ||
listOf("https://", "http://"), | ||
"https://www.getstream.io", | ||
), | ||
Arguments.of( | ||
"HTtPS://www.getstream.io/SomePath", | ||
listOf("https://", "http://"), | ||
"https://www.getstream.io/SomePath", | ||
), | ||
Arguments.of( | ||
"www.getstream.io/SomePath", | ||
listOf("https://", "http://"), | ||
"https://www.getstream.io/SomePath", | ||
), | ||
) | ||
} | ||
} |