test/test_schema.rb in avro-salsify-fork-1.9.0.0 vs test/test_schema.rb in avro-salsify-fork-1.9.0.1
- old
+ new
@@ -130,9 +130,24 @@
{'name' => 'reference', 'type' => 'my.name.space.InnerFixed'}
]
}
end
+ def test_to_avro_includes_logical_type
+ schema = Avro::Schema.parse <<-SCHEMA
+ {"type": "record", "name": "has_logical", "fields": [
+ {"name": "dt", "type": {"type": "int", "logicalType": "date"}}]
+ }
+ SCHEMA
+
+ assert_equal schema.to_avro, {
+ 'type' => 'record', 'name' => 'has_logical',
+ 'fields' => [
+ {'name' => 'dt', 'type' => {'type' => 'int', 'logicalType' => 'date'}}
+ ]
+ }
+ end
+
def test_unknown_named_type
error = assert_raise Avro::UnknownSchemaError do
Avro::Schema.parse <<-SCHEMA
{"type": "record", "name": "my.name.space.Record", "fields": [
{"name": "reference", "type": "MissingType"}