コード例 #1
0
func TestValidate_FieldsOnCorrectTypeErrorMessage_WorksWithNoSuggestions(t *testing.T) {
	message := graphql.UndefinedFieldMessage("T", "f", []string{})
	expected := `Cannot query field "T" on type "f".`
	if message != expected {
		t.Fatalf("Unexpected message, expected: %v, got %v", expected, message)
	}
}
コード例 #2
0
func TestValidate_FieldsOnCorrectTypeErrorMessage_WorksWithLotsOfSuggestions(t *testing.T) {
	message := graphql.UndefinedFieldMessage("T", "f", []string{"A", "B", "C", "D", "E", "F"})
	expected := `Cannot query field "T" on type "f". ` +
		`However, this field exists on "A", "B", "C", "D", "E", and 1 other types. ` +
		`Perhaps you meant to use an inline fragment?`
	if message != expected {
		t.Fatalf("Unexpected message, expected: %v, got %v", expected, message)
	}
}