Skip to content

Commit

Permalink
Merge pull request #834 from fd4s/fix-serde-tests
Browse files Browse the repository at this point in the history
Fix serde tests for CE3.3
  • Loading branch information
bplommer authored Jan 8, 2022
2 parents 85db114 + f388bb3 commit 74d630d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/src/main/mdoc/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ codecs against a [schema registry](https://docs.confluent.io/platform/current/sc
A usage example:

```scala mdoc:reset
import cats.effect.unsafe.implicits.global
import fs2.kafka.vulcan.SchemaRegistryClientSettings
import org.apache.avro.SchemaCompatibility.SchemaCompatibilityType
import fs2.kafka.vulcan.testkit.SchemaSuite
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2021 OVO Energy Limited
* Copyright 2018-2022 OVO Energy Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down
9 changes: 6 additions & 3 deletions modules/core/src/test/scala/fs2/kafka/DeserializerSpec.scala
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package fs2.kafka

import cats.Eq
import cats.effect.IO
import cats.laws.discipline._

final class DeserializerSpec extends BaseCatsSpec {
import cats.effect.unsafe.implicits.global

checkAll(
"Deserializer[IO, *]", {
implicit val ticker = Ticker()
// use of Ticker causes an error since CE3.3.0
// implicit val ticker = Ticker()
implicit def eq[A: Eq]: Eq[IO[A]] = Eq.by(_.attempt.unsafeRunSync())
MonadErrorTests[Deserializer[IO, *], Throwable].monadError[String, String, String]
}
)

import cats.effect.unsafe.implicits.global

test("Deserializer#attempt") {
forAll { (topic: String, headers: Headers, i: Int) =>
val bytes = Serializer[IO, Int].serialize(topic, headers, i).unsafeRunSync()
Expand Down
8 changes: 5 additions & 3 deletions modules/core/src/test/scala/fs2/kafka/SerializerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import org.scalacheck.Arbitrary
import org.scalatest._

final class SerializerSpec extends BaseCatsSpec {
import cats.effect.unsafe.implicits.global

checkAll(
"Serializer[IO, *]", {
implicit val ticker = Ticker()
// use of Ticker causes an error since CE3.3.0
// implicit val ticker = Ticker()
implicit val eq: Eq[IO[Array[Byte]]] = Eq.by(_.unsafeRunSync())
ContravariantTests[Serializer[IO, *]].contravariant[String, String, String]
}
)

import cats.effect.unsafe.implicits.global

test("Serializer#mapBytes") {
val serializer =
Serializer
Expand Down

0 comments on commit 74d630d

Please sign in to comment.