I’m trying to test a scenario in which a client sends a GraphQL document that defines multiple subscription operations. It seems Absinthe Phoenix’s push_doc
function doesn’t support adding an operationName
: Absinthe.Phoenix.SubscriptionTest.push_doc — absinthe_phoenix v2.0.2
Shouldn’t this function look something like this?
@spec push_doc(Phoenix.Socket.t(), String.t(), opts) :: reference()
def push_doc(socket, query, opts \\ []) do
Phoenix.ChannelTest.push(socket, "doc", %{
"query" => query,
"variables" => opts[:variables] || %{},
"operationName" => opts[:operation_name] || nil
})
end
I tried modifying it and recompiling the dep, but am still getting an error saying that no valid operationName was specified. My call site looks like this:
ref = push_doc(socket, @graphql_document, [variables: variables, operation_name: "MyOperation"])