mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 03:17:13 +01:00
Add tests for unknown user agents.
This commit is contained in:
parent
4c173a79ae
commit
8663fe8c74
@ -88,6 +88,15 @@ private val AN_EXPECTED_RESULT_LIST_FOR_WEB = listOf(
|
||||
DeviceUserAgent(DeviceType.WEB, "Edge", "Windows NT 10.0", null, null),
|
||||
)
|
||||
|
||||
private val AN_UNKNOWN_USER_AGENT_LIST = listOf(
|
||||
"AppleTV11,1/11.1",
|
||||
"Curl Client/1.0",
|
||||
)
|
||||
private val AN_UNKNOWN_USER_AGENT_EXPECTED_RESULT_LIST = listOf(
|
||||
DeviceUserAgent(DeviceType.UNKNOWN, null, null, null, null),
|
||||
DeviceUserAgent(DeviceType.UNKNOWN, null, null, null, null),
|
||||
)
|
||||
|
||||
class ParseDeviceUserAgentUseCaseTest {
|
||||
|
||||
private val parseDeviceUserAgentUseCase = ParseDeviceUserAgentUseCase()
|
||||
@ -119,4 +128,11 @@ class ParseDeviceUserAgentUseCaseTest {
|
||||
parseDeviceUserAgentUseCase.execute(userAgent) shouldBeEqualTo AN_EXPECTED_RESULT_LIST_FOR_WEB[index]
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given an unknown user agent then it should be parsed as expected`() {
|
||||
AN_UNKNOWN_USER_AGENT_LIST.forEachIndexed { index, userAgent ->
|
||||
parseDeviceUserAgentUseCase.execute(userAgent) shouldBeEqualTo AN_UNKNOWN_USER_AGENT_EXPECTED_RESULT_LIST[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user