-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Expose
ExplainEnum
in the GQL schema (#1204)
Adds ExplainEnum to the GQL schema. It fixes the introspection query error with Altair and GraphiQL. Adds a test for the enum existence in resulting response schema.
- Loading branch information
1 parent
0077635
commit 8cf6855
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2022 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package schema | ||
|
||
import ( | ||
"testing" | ||
|
||
schemaTypes "github.com/sourcenetwork/defradb/request/graphql/schema/types" | ||
) | ||
|
||
// TestIntrospectionExplainTypeDefined tests that the introspection query returns a schema that | ||
// defines the ExplainType enum. | ||
func TestIntrospectionExplainTypeDefined(t *testing.T) { | ||
test := RequestTestCase{ | ||
Schema: []string{}, | ||
IntrospectionRequest: ` | ||
query IntrospectionQuery { | ||
__schema { | ||
types { | ||
kind | ||
name | ||
description | ||
} | ||
} | ||
} | ||
`, | ||
ContainsData: map[string]any{ | ||
"__schema": map[string]any{ | ||
"types": []any{ | ||
map[string]any{ | ||
"description": schemaTypes.ExplainEnum.Description(), | ||
"kind": "ENUM", | ||
"name": "ExplainType", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
ExecuteRequestTestCase(t, test) | ||
} |