Skip to content

Commit

Permalink
Update test to support dql directives
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcneely committed Jan 17, 2025
1 parent d82fe2e commit 9773282
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion graphql/e2e/common/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io"
"math/rand"
"net/http"
"regexp"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -2108,9 +2109,13 @@ func queriesWithDebugFlagHaveDQLQueryInExtensions(t *testing.T) {

gqlResponse := query.ExecuteAsPost(t, GraphqlURL+"?debug=true")
RequireNoGQLErrors(t, gqlResponse)

// Needed for directives tests (Post remapped to myPost)
pattern := regexp.MustCompile(`query \{\n\s*query(?:Post|myPost)\(func: type\((?:Post|myPost)\)\) \{\n\s*Post\.title : (?:Post|myPost)\.title\n\s*dgraph\.uid : uid\n\s*\}\n\}`)

require.Contains(t, gqlResponse.Extensions, "dql_query")
require.NotEmpty(t, gqlResponse.Extensions["dql_query"])
require.Equal(t, "query {\n queryPost(func: type(Post)) {\n Post.title : Post.title\n dgraph.uid : uid\n }\n}", gqlResponse.Extensions["dql_query"])
require.True(t, pattern.MatchString(gqlResponse.Extensions["dql_query"].(string)))
}

func erroredQueriesHaveTouchedUids(t *testing.T) {
Expand Down

0 comments on commit 9773282

Please sign in to comment.