mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Add unit test for iOS user agents.
This commit is contained in:
parent
2bcf0c307d
commit
41643ffb53
1 changed files with 16 additions and 0 deletions
|
@ -37,6 +37,15 @@ private val AN_EXPECTED_RESULT_LIST_FOR_ANDROID = listOf(
|
|||
DeviceUserAgent(DeviceType.MOBILE, "SM-G610M Build/NRD90M", "Android 7.0", "Element", "1.0.0"),
|
||||
)
|
||||
|
||||
private val A_USER_AGENT_LIST_FOR_IOS = listOf(
|
||||
"Element/1.8.21 (iPhone; iOS 15.2; Scale/3.00)",
|
||||
"Element/1.8.21 (iPhone XS Max; iOS 15.2; Scale/3.00)",
|
||||
)
|
||||
private val AN_EXPECTED_RESULT_LIST_FOR_IOS = listOf(
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPhone", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPhone XS Max", "iOS 15.2", "Element", "1.8.21"),
|
||||
)
|
||||
|
||||
class ParseDeviceUserAgentUseCaseTest {
|
||||
|
||||
private val parseDeviceUserAgentUseCase = ParseDeviceUserAgentUseCase()
|
||||
|
@ -47,4 +56,11 @@ class ParseDeviceUserAgentUseCaseTest {
|
|||
parseDeviceUserAgentUseCase.execute(userAgent) shouldBeEqualTo AN_EXPECTED_RESULT_LIST_FOR_ANDROID[index]
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given an iOS user agent then it should be parsed as expected`() {
|
||||
A_USER_AGENT_LIST_FOR_IOS.forEachIndexed { index, userAgent ->
|
||||
parseDeviceUserAgentUseCase.execute(userAgent) shouldBeEqualTo AN_EXPECTED_RESULT_LIST_FOR_IOS[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue