Skip to content

Commit

Permalink
Extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmveel committed May 14, 2024
1 parent 3ee8757 commit 355c074
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
}

0 comments on commit 355c074

Please sign in to comment.