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()
|
||||
|
||||
iotest("should create, read, and delete a tag") {
|
||||
val tagValue = TagValue.validate("x").get
|
||||
val tagValue = TagValue.unsafe("x")
|
||||
val createdAt = CreatedAt.now(clock)
|
||||
transactor.use { xa =>
|
||||
(for
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ object TagValue:
|
|||
def validate(candidate: String): Option[TagValue] =
|
||||
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 Eq[TagValue] = (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue