Skip to content

Commit

Permalink
tests: add tests for RemoteFieldConfigDefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Feb 20, 2024
1 parent 5d3a86d commit b99f498
Showing 1 changed file with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.wordpress.android.processor

import org.junit.Assert.*
import org.junit.Test

class RemoteFieldConfigDefaultsBuilderTest {

@Test
fun `given a list of remote fields, when building the object, then generate list of remote fields`() {
// given
val keyA = "keyA"
val valueA = "valueA"
val keyB = "keyB"
val valueB = "valueB"

// when
val sut = RemoteFieldConfigDefaultsBuilder(mapOf(keyA to valueA, keyB to valueB))

// then
assertEquals(
"""
// Automatically generated file. DO NOT MODIFY
package org.wordpress.android.util.config
import kotlin.Any
import kotlin.String
import kotlin.collections.Map
object RemoteFieldConfigDefaults {
val remoteFieldConfigDefaults: Map<String, Any> = mapOf(
"$keyA" to "$valueA",
"$keyB" to "$valueB"
)
}
""".trimIndent(), sut.getContent().toString()
)
}

@Test
fun `given an empty list of remote fields, when building the object, then generate empty list of remote fields`() {
// given
val remoteFields = emptyMap<String, String>()

// when
val sut = RemoteFieldConfigDefaultsBuilder(remoteFields)

// then
assertEquals(
"""
// Automatically generated file. DO NOT MODIFY
package org.wordpress.android.util.config
import kotlin.Any
import kotlin.String
import kotlin.collections.Map
object RemoteFieldConfigDefaults {
val remoteFieldConfigDefaults: Map<String, Any> = mapOf(
)
}
""".trimIndent(), sut.getContent().toString()
)
}
}

0 comments on commit b99f498

Please sign in to comment.