Skip to content

Commit

Permalink
⬆️ Update sbt-typelevel to 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jwojnowski committed Apr 29, 2024
1 parent 9c42678 commit 5d0a591
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
14 changes: 7 additions & 7 deletions circe/src/test/scala/me/wojnowski/humanoid/circe/CodecTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package me.wojnowski.humanoid.circe

import io.circe.parser.decode
import io.circe.syntax.*
import io.circe.syntax._
import me.wojnowski.humanoid.HumanId
import me.wojnowski.humanoid.HumanIdOps
import me.wojnowski.humanoid.LowercaseStringId
Expand All @@ -36,23 +36,23 @@ class CodecTest extends FunSuite {
val humanIdJsonWithoutPrefix: String = "\"idvalue\""

test("encoder encodes with prefix") {
import me.wojnowski.humanoid.circe.strict.*
import me.wojnowski.humanoid.circe.strict._

val result = humanId.asJson.noSpaces

assertEquals(result, humanIdJsonWithPrefix)
}

test("relaxed decoder accepts ID without prefix") {
import me.wojnowski.humanoid.circe.relaxed.*
import me.wojnowski.humanoid.circe.relaxed._

val result = decode[HumanId["pfx", LowercaseStringId]](humanIdJsonWithoutPrefix)

assertEquals(result, Right(humanId))
}

test("relaxed decoder accepts ID with wrong prefix if it parses as valid ID") {
import me.wojnowski.humanoid.circe.relaxed.*
import me.wojnowski.humanoid.circe.relaxed._

val result = decode[HumanId["other", String]](humanIdJsonWithPrefix)
val expected = Right(HumanIdOps["other", String].fromId(humanId.renderWithPrefix))
Expand All @@ -61,22 +61,22 @@ class CodecTest extends FunSuite {
}

test("strict decoder accepts ID with correct prefix") {
import me.wojnowski.humanoid.circe.strict.*
import me.wojnowski.humanoid.circe.strict._

val result = decode[HumanId["pfx", LowercaseStringId]](humanIdJsonWithPrefix)

assertEquals(result, Right(humanId))
}

test("strict decoder rejects ID with incorrect prefix") {
import me.wojnowski.humanoid.circe.strict.*
import me.wojnowski.humanoid.circe.strict._

val result = decode[HumanId["other", String]](humanIdJsonWithPrefix)
assert(result.isLeft)
}

test("strict decoder rejects ID without prefix") {
import me.wojnowski.humanoid.circe.strict.*
import me.wojnowski.humanoid.circe.strict._

val result = decode[HumanId["other", LowercaseStringId]](humanIdJsonWithoutPrefix)
assert(result.isLeft)
Expand Down
5 changes: 2 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.0")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.7.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package me.wojnowski.humanoid.tapir.relaxed

import me.wojnowski.humanoid.*
import me.wojnowski.humanoid._
import sttp.tapir.Codec
import sttp.tapir.Codec.PlainCodec

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package me.wojnowski.humanoid.tapir.strict

import me.wojnowski.humanoid.*
import me.wojnowski.humanoid._
import sttp.tapir.Codec
import sttp.tapir.Codec.PlainCodec

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CodecsTest extends FunSuite {
val rawHumanIdWithoutPrefix: String = "idvalue"

test("strict encodes with prefix") {
import me.wojnowski.humanoid.tapir.strict.*
import me.wojnowski.humanoid.tapir.strict._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].encode(humanId)
val expected = rawHumanIdWithPrefix
Expand All @@ -48,7 +48,7 @@ class CodecsTest extends FunSuite {
}

test("relaxed encodes with prefix") {
import me.wojnowski.humanoid.tapir.relaxed.*
import me.wojnowski.humanoid.tapir.relaxed._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].encode(humanId)
val expected = rawHumanIdWithPrefix
Expand All @@ -57,7 +57,7 @@ class CodecsTest extends FunSuite {
}

test("strict decodes prefixed ID") {
import me.wojnowski.humanoid.tapir.strict.*
import me.wojnowski.humanoid.tapir.strict._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].decode(rawHumanIdWithPrefix)
val expected = DecodeResult.Value(humanId)
Expand All @@ -66,15 +66,15 @@ class CodecsTest extends FunSuite {
}

test("strict decoding fails on no prefix") {
import me.wojnowski.humanoid.tapir.strict.*
import me.wojnowski.humanoid.tapir.strict._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].decode(rawHumanIdWithoutPrefix)

assert(result.isInstanceOf[DecodeResult.Failure])
}

test("relaxed decodes prefixed ID") {
import me.wojnowski.humanoid.tapir.relaxed.*
import me.wojnowski.humanoid.tapir.relaxed._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].decode(rawHumanIdWithPrefix)
val expected = DecodeResult.Value(humanId)
Expand All @@ -83,7 +83,7 @@ class CodecsTest extends FunSuite {
}

test("relaxed decodes no prefix") {
import me.wojnowski.humanoid.tapir.relaxed.*
import me.wojnowski.humanoid.tapir.relaxed._

val result = implicitly[Codec[String, PrefixedId, CodecFormat.TextPlain]].decode(rawHumanIdWithoutPrefix)
val expected = DecodeResult.Value(humanId)
Expand All @@ -92,7 +92,7 @@ class CodecsTest extends FunSuite {
}

test("relaxed decodes wrong prefix if ID is valid") {
import me.wojnowski.humanoid.tapir.relaxed.*
import me.wojnowski.humanoid.tapir.relaxed._

val result = implicitly[Codec[String, HumanId["pfx", String], CodecFormat.TextPlain]].decode("other_idvalue")
val expected = DecodeResult.Value(HumanIdOps["pfx", String].fromId("other_idvalue"))
Expand Down
2 changes: 1 addition & 1 deletion uuid/src/test/scala/UuidGeneratorTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import cats.effect.std.UUIDGen
import me.wojnowski.humanoid.HumanId
import me.wojnowski.humanoid.HumanIdOps
import me.wojnowski.humanoid.uuid.*
import me.wojnowski.humanoid.uuid._
import munit.FunSuite

import java.util.UUID
Expand Down

0 comments on commit 5d0a591

Please sign in to comment.