mmport80
Absinthe & Testing
Any tips for testing an Absinthe API?
I have a feeling it could be very nice, with the typing information GraphQL gives us and a dash of randomisation - quickcheck style…
Perhaps that’s already the done thing though?
Most Liked
benwilson512
Yeah this is an idea I’ve been really excited about for a while, but I just haven’t had the time to invest in the tooling needed to make this actually happen. You’re always welcome to be the first!
law
I wrote Kronky, which has some helpers for testing Absinthe, among other things. There are example test cases in the docs. In short it looks like
query = """
{ user(id: "1")
{
firstName
lastName
age
}
}
"""
{:ok, %{data: data}} = evaluate_graphql(query)
user_fields = %{first_name: :string, last_name: string, age: integer}
expected = %User{first_name: "Lilo", last_name: "Pelekai", age: 6}
%{"user" => result} = data
assert_equivalent_graphql(expected, result, user_fields)
If you subscribe to Elixir Sips, they also have an Absinthe Episode with some tests.
OvermindDL1
Currently I just call the absinthe api from my tests and check what is returned… ^.^;
It might be fairly easily doable to setup a propcheck style tests for it though.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








