Skip to content

Commit

Permalink
add test for ConfigWriter retaining a list of maps in minimized config
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-kai committed Nov 25, 2024
1 parent b5c26c5 commit 6172fe6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ testservice {
strval: "xxx"
overridenInt: 555
explicitInt: 111

mapList: [
{ a: 1 },
{ b: 2, c: 3}
]
systemPropInt: 222
systemPropList: [1, 2, 3]
unrequiredEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cats.effect.IO
import cats.effect.unsafe.IORuntime
import com.github.pshirshov.test.plugins.{StaticTestMainLogIO2, StaticTestRole}
import com.github.pshirshov.test3.plugins.Fixture3
import com.typesafe.config.ConfigFactory
import com.typesafe.config.{ConfigFactory, ConfigObject}
import distage.{DIKey, Injector, Locator, LocatorRef}
import izumi.distage.framework.config.PlanningOptions
import izumi.distage.framework.services.RoleAppPlanner
Expand Down Expand Up @@ -323,6 +323,10 @@ class RoleAppTest extends AnyWordSpec with WithProperties {
assert(role0CfgMinParsed.hasPath("testservice2"))
assert(role0CfgMinParsed.hasPath("testservice"))
assert(role0CfgMinParsed.hasPath("genericservice"))
assert(role0CfgMinParsed.hasPath("testservice.mapList"))
val l = role0CfgMinParsed.getList("testservice.mapList")
assert(l.get(0).asInstanceOf[ConfigObject].unwrapped().asScala.toMap == Map("a" -> 1))
assert(l.get(1).asInstanceOf[ConfigObject].unwrapped().asScala.toMap == Map("b" -> 2, "c" -> 3))

assert(role0CfgMinParsed.hasPath("genericservice.genericField"))
assert(role0CfgMinParsed.hasPath("genericservice.addedField"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ object Fixture {
explicitInt: Int,
systemPropInt: Int,
systemPropList: List[Int],
mapList: List[Map[String, Int]],
a: A,
)

Expand Down

0 comments on commit 6172fe6

Please sign in to comment.