This commit is contained in:
Sunli 2021-12-05 09:43:44 +08:00
parent ffedb9556b
commit c41f87c645
1 changed files with 20 additions and 7 deletions

View File

@ -47,7 +47,6 @@ enum UnreferencedInterface {
ObjectC(ObjectC),
}
#[derive(Union)]
enum ObjectUnion {
ObjectA(ObjectA),
@ -62,14 +61,16 @@ impl Query {
ObjectA {
id: 33,
title: "haha".to_string(),
}.into()
}
.into()
}
async fn explicit(&self) -> ExplicitInterface {
ObjectA {
id: 40,
title: "explicit".to_string(),
}.into()
}
.into()
}
}
@ -111,13 +112,25 @@ pub async fn test_interface_exports_interfaces_on_object_type() {
.unwrap()
.data,
)
.unwrap();
.unwrap();
assert_eq!(resp.ty.name, "ObjectA");
assert_eq!(resp.ty.kind, "OBJECT");
assert!(resp.ty.interfaces.iter().any(|i| i.name == "ExplicitInterface"));
assert!(resp.ty.interfaces.iter().any(|i| i.name == "ImplicitInterface"));
assert!(!resp.ty.interfaces.iter().any(|i| i.name == "InvisibleInterface"));
assert!(resp
.ty
.interfaces
.iter()
.any(|i| i.name == "ExplicitInterface"));
assert!(resp
.ty
.interfaces
.iter()
.any(|i| i.name == "ImplicitInterface"));
assert!(!resp
.ty
.interfaces
.iter()
.any(|i| i.name == "InvisibleInterface"));
}
#[tokio::test]