{"id":13833589,"url":"https://github.com/maartenvanvliet/artem","last_synced_at":"2025-08-03T06:43:36.353Z","repository":{"id":41730585,"uuid":"316059891","full_name":"maartenvanvliet/artem","owner":"maartenvanvliet","description":"Library to aid in Absinthe graphql testing","archived":false,"fork":false,"pushed_at":"2023-03-03T04:58:07.000Z","size":52,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T12:54:49.856Z","etag":null,"topics":["absinthe","elixir","exunit","graphql"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/artem/Artem.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maartenvanvliet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-25T21:42:37.000Z","updated_at":"2023-02-14T15:17:50.000Z","dependencies_parsed_at":"2024-08-04T12:01:26.026Z","dependency_job_id":"1d68f581-7d12-429d-be64-5e71cdef535f","html_url":"https://github.com/maartenvanvliet/artem","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.3793103448275862,"last_synced_commit":"2dcd54d1e1b5518e1cb05dcabba98dc79e1fe162"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maartenvanvliet%2Fartem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maartenvanvliet%2Fartem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maartenvanvliet%2Fartem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maartenvanvliet%2Fartem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maartenvanvliet","download_url":"https://codeload.github.com/maartenvanvliet/artem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805212,"owners_count":21164249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["absinthe","elixir","exunit","graphql"],"created_at":"2024-08-04T12:00:51.471Z","updated_at":"2025-04-14T01:20:38.872Z","avatar_url":"https://github.com/maartenvanvliet.png","language":"Elixir","funding_links":[],"categories":["Running the update"],"sub_categories":["By Popularity"],"readme":"# Artem\n\n## [![Hex pm](http://img.shields.io/hexpm/v/artem.svg?style=flat)](https://hex.pm/packages/artem) [![Hex Docs](https://img.shields.io/badge/hex-docs-9768d1.svg)](https://hexdocs.pm/artem) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)![.github/workflows/elixir.yml](https://github.com/maartenvanvliet/artem/workflows/.github/workflows/elixir.yml/badge.svg)\n\n---\n\nLibrary to help testing Absinthe graphql queries.\n\nIt has several features to aid in testing:\n\n- precompile queries during compile time\n- use sigils for less verbose syntax\n- generates functions for named graphql operations\n\n## Installation\n\nThe package can be installed\nby adding `artem` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:artem, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\n## Usage\n\nAdd the `Artem` module with the `use` clause. You'll need to\nsupply the `schema:` option with the Absinthe schema under test.\n\n```elixir\ndefmodule ArtemTest do\n  use ExUnit.Case\n\n  use Artem, schema: Your.Absinthe.Schema\nend\n```\n\nNow you get access to the macros supplied by Artem. There are a couple of ways\nto use them\n\n### Sigils\n\nThe first approach is using sigils\n\n```elixir\ndefmodule ArtemTest do\n  #...\n  @version_query ~q\"\n    query {\n      version\n    }\n  \"\n  test \"run query\" do\n    assert {:ok, %{data: %{\"version\" =\u003e \"201008\"}}} == Artem.run(@version_query)\n  end\n\n```\n\nThis precompiles the document into the `@version_query` module attribute. If you run\nthis document multiple times in your tests you'll only have to run the static parts\n(parsing/some validation) of the document once. This can also be used outside of testing,\nif your app relies on internal graphql queries for example.\n\n### Generated functions\n\nThe second approach builds on this but when your graphql operations are named\nthey are compiled into functions you can call.\n\n```elixir\ndefmodule ArtemTest do\n  #...\n  ~q\"\n    query MyTest($format: String{\n      datetime(format: $format)\n    }\n  \"\n\n  test \"run query\" do\n    assert {:ok, %{data: %{\"datetime\" =\u003e \"201008\"}}} ==\n            my_test(variables: %{format: \"YYMMDD\"}, context: %{current_user_id: 1})\n  end\n\n```\n\nYou can pass in the variables/context into the function.\n\nNote that the name of the function is snake_cased from the camelized name of\nthe operation.\n\n### precompile/2\n\nThe third way is using the precompile/2 macro\n\n```elixir\ndefmodule ArtemTest do\n  #...\n  @query precompile(\"\n    query {\n      version\n    }\n  \")\n\n  test \"run query\" do\n    assert {:ok, %{data: %{\"version\" =\u003e \"201008\"}}} == Artem.run(@query)\n  end\n\n```\n\nThe sigil is syntactic sugar for calling the precompile macro. You can\nuse this for more direct control over this process, allowing easier\ncomposability.\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/artem](https://hexdocs.pm/artem).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaartenvanvliet%2Fartem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaartenvanvliet%2Fartem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaartenvanvliet%2Fartem/lists"}