minor cleanup
This commit is contained in:
parent
f10f79ed95
commit
53a0114cbb
2 changed files with 6 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ class DoobieTagDbTests extends munit.FunSuite:
|
||||||
private val clock = Clock.systemDefaultZone()
|
private val clock = Clock.systemDefaultZone()
|
||||||
|
|
||||||
iotest("should create, read, and delete a tag") {
|
iotest("should create, read, and delete a tag") {
|
||||||
val tagValue = TagValue.validate("x").get
|
val tagValue = TagValue.unsafe("x")
|
||||||
val createdAt = CreatedAt.now(clock)
|
val createdAt = CreatedAt.now(clock)
|
||||||
transactor.use { xa =>
|
transactor.use { xa =>
|
||||||
(for
|
(for
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ object TagValue:
|
||||||
def validate(candidate: String): Option[TagValue] =
|
def validate(candidate: String): Option[TagValue] =
|
||||||
if candidate.isEmpty() then None else Some(candidate)
|
if candidate.isEmpty() then None else Some(candidate)
|
||||||
|
|
||||||
|
def unsafe(candidate: String): TagValue =
|
||||||
|
if candidate.isEmpty() then
|
||||||
|
throw new IllegalArgumentException("Tag values must be non-empty.")
|
||||||
|
else candidate
|
||||||
|
|
||||||
given CanEqual[TagValue, TagValue] = CanEqual.derived
|
given CanEqual[TagValue, TagValue] = CanEqual.derived
|
||||||
|
|
||||||
given Eq[TagValue] = (
|
given Eq[TagValue] = (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue