Delete old test_introspection.rs file

This commit is contained in:
krevativ 2020-05-17 20:57:55 +02:00
parent ee32ea5455
commit b12fed4b56

View File

@ -1,98 +0,0 @@
use async_graphql::*;
/// Is SimpleObject
#[SimpleObject]
struct SimpleObject {
/// Value a
a: i32,
#[field(desc = "Value b")]
b: String,
#[field(deprecation = "Test deprecated")]
c: bool,
}
struct Query;
#[Object]
impl Query {
/// Get a simple object
async fn simple_object(&self) -> SimpleObject {
unimplemented!()
}
}
#[async_std::test]
pub async fn test_introspection() {
let schema = Schema::new(Query, EmptyMutation, EmptySubscription);
let res = schema
.execute(
r#"
{
__type(name: "SimpleObject") {
kind
name
description
fields(includeDeprecated: true) {
name
description
args { name }
type { name kind ofType { name kind } }
isDeprecated
deprecationReason
}
interfaces { name }
possibleTypes { name }
enumValues { name }
inputFields { name }
ofType { name }
}
}"#,
)
.await
.unwrap()
.data;
assert_eq!(
res,
serde_json::json!({
"__type": {
"kind": "OBJECT",
"name": "SimpleObject",
"description": "Is SimpleObject",
"fields": [
{
"name": "a",
"description": "Value a",
"args": [],
"type": { "name": null, "kind": "NON_NULL", "ofType": { "name": "Int", "kind": "SCALAR" } },
"isDeprecated": false,
"deprecationReason": null,
},
{
"name": "b",
"description": "Value b",
"args": [],
"type": { "name": null, "kind": "NON_NULL", "ofType": { "name": "String", "kind": "SCALAR" } },
"isDeprecated": false,
"deprecationReason": null,
},
{
"name": "c",
"description": null,
"args": [],
"type": { "name": null, "kind": "NON_NULL", "ofType": { "name": "Boolean", "kind": "SCALAR" } },
"isDeprecated": true,
"deprecationReason": "Test deprecated",
},
],
"interfaces": [],
"possibleTypes": null,
"enumValues": null,
"inputFields": null,
"ofType": null,
}
})
)
}