Tinfoil_Security
Wormwood is a small open source lib to help unit test GraphQL query documents against an Absinthe API. It requires no Plug.Conn s and removes lots of boilerplate using macros!
You can load in a GQL document file using a simple macro, and quickly execute the query against your Absinthe schema!
Simple example:
defmodule Wormwood.Test.Examples.GetUsersTest do
use ExUnit.Case
use Wormwood.GQLCase
load_gql My.Absinthe.Schema, "assets/GetUsers.gql"
describe "GetUsers.gql" do
test "Should return a list of all the users" do
# running the query! No conn or JSON required.
result = query_gql(variables: %{}, context: %{:current_user => ...})
assert {:ok, query_data} = result
# ...
end
end
end
Quick Feature List:
- Avoid’s boilerplate code when unit testing your Absinthe API.
- Pass context, and variables into your query using the
query_gql/1function. - Supports
#importstatements in GQL documents for fragments! - Executes GQL document files and plain query strings.
- Allows you to test the same query documents you ship to your users!
- Provides methods to help query using a custom Absinthe pipeline.
Github: https://github.com/tinfoil/wormwood
Hex: https://hex.pm/packages/wormwood
Hexdocs: https://hexdocs.pm/wormwood/readme.html
– Tinfoil Engineering Team
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
joshtaylor
This is awesome!
One of the “problems” with testing GQL is the amount of boilerplate you have to write, mainly around syncing of queries in tests. I ended up doing similar where I included the gql file in a file and loaded it.
uhrobots
Thanks for the reply @joshtaylor!
I’ve also written up a blog post on the Tinfoil website with some more detailed examples and a breakdown of more advanced usage!
Post: Wormwood - an Explicit Way to Test Absinthe GraphQL APIs | Black Duck Blog
ekobi
Very timely for me. Thanks for sharing!
AstonJ
Love the name as well, wormwood = Artemisia absinthium. A powerful herb used for its anti parasitic and anti-inflammatory properties