Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Jan 7, 2025
1 parent 40c11bf commit f53ca10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import com.wire.kalium.network.api.authenticated.client.ClientCapabilityDTO
import com.wire.kalium.network.api.authenticated.client.ClientDTO
import com.wire.kalium.network.api.authenticated.client.ClientTypeDTO
import com.wire.kalium.network.api.authenticated.client.DeviceTypeDTO
import com.wire.kalium.network.tools.KtxSerializer
import kotlinx.serialization.encodeToString

object ClientResponseJson {
private val jsonProvider = { serializable: ClientDTO ->
Expand All @@ -36,7 +38,7 @@ object ClientResponseJson {
| "cookie": "${serializable.cookie}",
| "model": "${serializable.model}",
| "capabilities": [
| "${serializable.capabilities[0]}"
| ${KtxSerializer.json.encodeToString(serializable.capabilities[0])}
| ],
| "mls_public_keys": ${serializable.mlsPublicKeys}
|}
Expand All @@ -57,9 +59,9 @@ object ClientResponseJson {
| "model": "${serializable.model}",
| "capabilities": {
| "capabilities": [
| "${serializable.capabilities[0]}"
| ${KtxSerializer.json.encodeToString(serializable.capabilities[0])}
| ]
| }
| },
| "mls_public_keys": ${serializable.mlsPublicKeys}
|}
""".trimMargin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ internal class ClientApiV0Test : ApiTest() {
@Test
fun givenAValidRegisterClientRequest_whenCallingTheRegisterClientEndpointWithOldFormat_theRequestShouldBeConfiguredCorrectly() =
runTest {

val rowJson = VALID_REGISTER_CLIENT_OLD_RESPONSE.rawJson
val data = VALID_REGISTER_CLIENT_OLD_RESPONSE.serializableData

val networkClient = mockAuthenticatedNetworkClient(
VALID_REGISTER_CLIENT_OLD_RESPONSE.rawJson,
rowJson,
statusCode = HttpStatusCode.Created,
assertion = {
assertPost()
Expand All @@ -77,7 +81,7 @@ internal class ClientApiV0Test : ApiTest() {
val clientApi: ClientApi = ClientApiV0(networkClient)
val response = clientApi.registerClient(REGISTER_CLIENT_REQUEST.serializableData)
assertTrue(response.isSuccessful())
assertEquals(VALID_REGISTER_CLIENT_OLD_RESPONSE.serializableData, response.value)
assertEquals(data, response.value)
}

@Test
Expand Down

0 comments on commit f53ca10

Please sign in to comment.