test.ex (805B)
1 defmodule Absinthe.Test do 2 @doc """ 3 Run the introspection query on a schema. 4 5 In your `test_helper.exs` file add 6 ``` 7 Absinthe.Test.prime(MyApp.Schema) 8 ``` 9 10 ## Explanation 11 12 In the test environment mix loads code lazily, which means that it isn't until 13 the first GraphQL query in your test suite runs that Absinthe's code base is 14 actually loaded. Absinthe is a lot of code, and so this can take several 15 milliseconds. This can be a problem for tests using message passing that expect 16 messages to happen within a certain amount of time. 17 18 By running the introspection query on your schema this function will cause mix 19 to load the majority of the Absinthe code base. 20 """ 21 def prime(schema_name) do 22 {:ok, %{data: _}} = Absinthe.Schema.introspect(schema_name) 23 :ok 24 end 25 end