diff --git a/src/converter/avro/src/commonTest/kotlin/community/flock/wirespec/convert/avro/AvroParserTest.kt b/src/converter/avro/src/commonTest/kotlin/community/flock/wirespec/convert/avro/AvroParserTest.kt index b07b1477a..726c3a45c 100644 --- a/src/converter/avro/src/commonTest/kotlin/community/flock/wirespec/convert/avro/AvroParserTest.kt +++ b/src/converter/avro/src/commonTest/kotlin/community/flock/wirespec/convert/avro/AvroParserTest.kt @@ -1,7 +1,10 @@ package community.flock.wirespec.convert.avro import com.goncalossilva.resources.Resource +import community.flock.wirespec.compiler.core.parse.nodes.Endpoint import community.flock.wirespec.compiler.core.parse.nodes.Enum +import community.flock.wirespec.compiler.core.parse.nodes.Node +import community.flock.wirespec.compiler.core.parse.nodes.Refined import community.flock.wirespec.compiler.core.parse.nodes.Type import community.flock.wirespec.convert.avro.AvroConverter.flatten import kotlin.test.Test @@ -18,6 +21,11 @@ class AvroParserTest { val schema = AvroParser.parse(resource.readText()) val ast = schema.flatten() + assertEquals( + listOf("User", "EmailAddress", "TwitterAccount", "OAuthStatus", "ToDoItem", "ToDoStatus"), + ast.map { it.toName() } + ) + assertEquals( Type( name = "User", @@ -101,8 +109,12 @@ class AvroParserTest { ast.last() ) - ast.forEach { - println(it) - } } +} + +private fun Node.toName() = when(this){ + is Type -> name + is Endpoint -> name + is Enum -> name + is Refined -> name } \ No newline at end of file