Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
pablf committed Aug 2, 2024
1 parent 0d80c32 commit 7732b7b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/shared/src/test/scala/zio/schema/DynamicValueSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,48 @@ object DynamicValueSpec extends ZIOSpecDefault {
},
test("round-trips Eithers") {
check(SchemaGen.anyEitherAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[Either[_, _]], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips Tuples") {
check(SchemaGen.anyTupleAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[(_, _)], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips Optionals") {
check(SchemaGen.anyOptionalAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[Option[_]], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips Transform") {
check(SchemaGen.anyTransformAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[_], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips CaseClass") {
check(SchemaGen.anyCaseClassAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[_], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips Enum") {
check(SchemaGen.anyEnumAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[_], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips any un-nested schema") {
check(SchemaGen.anyLeafAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[_], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips any nested schema") {
check(SchemaGen.anyTree(1).flatMap(s => DynamicValueGen.anyDynamicValueOfSchema(s).map(s -> _))) {
case (schema, dynamic) =>
assert(schema.fromDynamic(dynamic))(isRight)
assert(schema.asInstanceOf[Schema[_]].fromDynamic(dynamic))(isRight)
}
},
test("round-trips recursive data types") {
check(SchemaGen.anyRecursiveTypeAndValue) {
case (schema, a) =>
case (schema: Schema[_], a) =>
assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
Expand All @@ -77,12 +77,12 @@ object DynamicValueSpec extends ZIOSpecDefault {
},
test("round-trips set") {
check(SchemaGen.anySetAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[_], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
},
test("round-trips map") {
check(SchemaGen.anyMapAndValue) {
case (schema, a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
case (schema: Schema[Map[_, _]], a) => assert(schema.fromDynamic(schema.toDynamic(a)))(isRight(equalTo(a)))
}
}
),
Expand Down

0 comments on commit 7732b7b

Please sign in to comment.