-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add safe ZIO methods builders of ConfigProvider (#1398)
- Loading branch information
1 parent
655ae01
commit 013712e
Showing
9 changed files
with
131 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...nolia-tests/shared/src/test/scala/zio/config/typesafe/TypesafeConfigProviderZIOTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package zio.config.typesafe | ||
|
||
import zio.Config | ||
import zio.config.magnolia.deriveConfig | ||
import zio.config.read | ||
import zio.test.Assertion.equalTo | ||
import zio.test.{Spec, ZIOSpecDefault, assertZIO} | ||
|
||
object TypesafeConfigProviderZIOTest extends ZIOSpecDefault { | ||
|
||
final case class DataBaseConfig(url: String) | ||
|
||
val configDataBaseConfig: Config[DataBaseConfig] = deriveConfig[DataBaseConfig] | ||
|
||
val hocconConfig: String = s"""url = "some_url"""" | ||
|
||
override def spec: Spec[Any, Config.Error] = | ||
suite("TypesafeConfigProviderZIOTest")( | ||
test("safe read config") { | ||
val result = read(configDataBaseConfig from TypesafeConfigProvider.fromHoconStringZIO(hocconConfig)) | ||
val expected = DataBaseConfig("some_url") | ||
assertZIO(result)(equalTo(expected)) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters