Skip to content

Commit

Permalink
added test for tuple-like array schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Apr 23, 2024
1 parent ea73309 commit 4c0e068
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,32 @@ class SchemaComparatorTest extends AnyFunSuite {
))
}

test("comparing tuple schemas") {
assert(compare(
arraySchema.copy(
prefixItems = Some(List(integerSchema, stringSchema, booleanSchema)),
),
arraySchema.copy(
prefixItems = Some(List(numberSchema, stringSchema)),
),
) == Nil)

assert(compare(
arraySchema.copy(
prefixItems = Some(List(integerSchema, stringSchema)),
),
arraySchema.copy(
prefixItems = Some(List(numberSchema, booleanSchema, stringSchema)),
),
) == List(
IncompatiblePrefixItem(1, List(
TypeMismatch(List(SchemaType.String), List(SchemaType.Boolean))
)),
IncompatiblePrefixItem(2, List(
GeneralSchemaMismatch(Schema.Empty, stringSchema)
))
))
}

//TODO significantly more tests
}

0 comments on commit 4c0e068

Please sign in to comment.