commonTest.com.genesys.cloud.messenger.transport.RegionConfigurationTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of messenger-transport-mobile-sdk Show documentation
Show all versions of messenger-transport-mobile-sdk Show documentation
This library provides methods for connecting to Genesys Cloud Messenger chat APIs and WebSockets from mobile applications.
package com.genesys.cloud.messenger.transport
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.genesys.cloud.messenger.transport.core.Configuration
import com.genesys.cloud.messenger.transport.core.MessengerTransportSDK
import io.ktor.http.Url
import kotlin.test.Test
class RegionConfigurationTest {
@Test
fun itShouldGetWebSocketUrl() {
val configuration = Configuration(
deploymentId = "foo",
domain = "mypurecloud.com",
)
val actual = configuration.webSocketUrl
val expected = Url("wss://webmessaging.mypurecloud.com/v1?deploymentId=foo&application=TransportSDK-${MessengerTransportSDK.sdkVersion}")
assertThat(actual, "WebSocket URL").isEqualTo(expected)
}
@Test
fun itShouldGetApiBaseUrl() {
val configuration = Configuration(
deploymentId = "foo",
domain = "mypurecloud.com",
)
val actual = configuration.apiBaseUrl
val expected = Url("https://api.mypurecloud.com")
assertThat(actual, "API Base URL").isEqualTo(expected)
}
@Test
fun itShouldGetDeploymentConfigUrl() {
val configuration = Configuration(
deploymentId = "foo",
domain = "mypurecloud.com",
)
val actual = configuration.deploymentConfigUrl
val expected = Url("https://api-cdn.mypurecloud.com/webdeployments/v1/deployments/foo/config.json")
assertThat(actual, "Deployment config URL").isEqualTo(expected)
}
}