Does anyone have a nice way to fake apollo query d...
# apollo-kotlin
b
Does anyone have a nice way to fake apollo query dataa in tests aside from creating them.. as in
val fakeQueryData = Query.Data(id = "blah" , name="steve")
ended up with a massing file of fakes for tests and was hoping there are some alternatives.
m
Several solutions: • Apollo Faker gives you fake data by annotating your schema with directives. It's the early days but I'm curious if you have any feedback. • Data Builders give you a DSL to build the
Data
classes. It's the historical solution but it suffers from a few limitations (generating the source files in the test source set, custom scalar are a bit weird, etc..) that we're aiming to fix in v5 • Apollo Kotlin Execution gives you the building blocks to build a complete executable schema, including resolvers, etc... Ultimately, this is the most flexible one as you can fake mutations, etc..
Another solution is to enqueue JSONs in MockServer. Forgot about this one since it's usually a bit more work of capturing the JSON, etc... but it can be useful too
That's probably too many options and I wish we had a recommended way to do this albeit I'm not sure which one is the best