Fix tests
This commit is contained in:
parent
14e3b4fe69
commit
9483ff14be
11
src/lib.rs
11
src/lib.rs
|
@ -447,7 +447,12 @@ pub use async_graphql_derive::InputObject;
|
|||
///
|
||||
/// ```ignore
|
||||
/// #[Interface]
|
||||
/// struct MyInterface(TypeA, TypeB, TypeC, ...);
|
||||
/// enum MyInterface {
|
||||
/// TypeA(TypeA),
|
||||
/// TypeB(TypeB),
|
||||
/// TypeC(TypeC),
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Fields
|
||||
|
@ -487,7 +492,9 @@ pub use async_graphql_derive::InputObject;
|
|||
/// arg(name = "a", type = "i32"),
|
||||
/// arg(name = "b", type = "i32")),
|
||||
/// )]
|
||||
/// struct MyInterface(TypeA);
|
||||
/// enum MyInterface {
|
||||
/// TypeA(TypeA)
|
||||
/// }
|
||||
///
|
||||
/// struct QueryRoot;
|
||||
///
|
||||
|
|
|
@ -140,7 +140,12 @@ struct HumanOrAlien(Human, Alien);
|
|||
arg(name = "surname", type = "Option<bool>")
|
||||
)
|
||||
)]
|
||||
struct Being(Dog, Cat, Human, Alien);
|
||||
enum Being {
|
||||
Dog(Dog),
|
||||
Cat(Cat),
|
||||
Human(Human),
|
||||
Alien(Alien),
|
||||
}
|
||||
|
||||
#[Interface(
|
||||
internal,
|
||||
|
@ -150,7 +155,10 @@ struct Being(Dog, Cat, Human, Alien);
|
|||
arg(name = "surname", type = "Option<bool>")
|
||||
)
|
||||
)]
|
||||
struct Pet(Dog, Cat);
|
||||
enum Pet {
|
||||
Dog(Dog),
|
||||
Cat(Cat),
|
||||
}
|
||||
|
||||
#[Interface(
|
||||
internal,
|
||||
|
@ -160,10 +168,15 @@ struct Pet(Dog, Cat);
|
|||
arg(name = "surname", type = "Option<bool>")
|
||||
)
|
||||
)]
|
||||
struct Canine(Dog);
|
||||
enum Canine {
|
||||
Dog(Dog),
|
||||
}
|
||||
|
||||
#[Interface(internal, field(name = "iq", type = "Option<i32>"))]
|
||||
struct Intelligent(Human, Alien);
|
||||
enum Intelligent {
|
||||
Human(Human),
|
||||
Alien(Alien),
|
||||
}
|
||||
|
||||
#[InputObject(internal)]
|
||||
struct ComplexInput {
|
||||
|
|
|
@ -9,7 +9,9 @@ pub async fn test_interface_simple_object() {
|
|||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "id", type = "i32"))]
|
||||
struct Node(MyObj);
|
||||
enum Node {
|
||||
MyObj(MyObj),
|
||||
}
|
||||
|
||||
struct Query;
|
||||
|
||||
|
@ -52,7 +54,9 @@ pub async fn test_interface_simple_object2() {
|
|||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "id", type = "&i32"))]
|
||||
struct Node(MyObj);
|
||||
enum Node {
|
||||
MyObj(MyObj),
|
||||
}
|
||||
|
||||
struct Query;
|
||||
|
||||
|
@ -105,10 +109,14 @@ pub async fn test_multiple_interfaces() {
|
|||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "value_a", type = "i32"))]
|
||||
struct InterfaceA(MyObj);
|
||||
enum InterfaceA {
|
||||
MyObj(MyObj),
|
||||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "value_b", type = "i32"))]
|
||||
struct InterfaceB(MyObj);
|
||||
enum InterfaceB {
|
||||
MyObj(MyObj),
|
||||
}
|
||||
|
||||
struct Query;
|
||||
|
||||
|
@ -176,10 +184,15 @@ pub async fn test_multiple_objects_in_multiple_interfaces() {
|
|||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "value_a", type = "i32"))]
|
||||
struct InterfaceA(MyObjOne, MyObjTwo);
|
||||
enum InterfaceA {
|
||||
MyObjOne(MyObjOne),
|
||||
MyObjTwo(MyObjTwo),
|
||||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "value_b", type = "i32"))]
|
||||
struct InterfaceB(MyObjOne);
|
||||
enum InterfaceB {
|
||||
MyObjOne(MyObjOne),
|
||||
}
|
||||
|
||||
struct Query;
|
||||
|
||||
|
@ -232,7 +245,9 @@ pub async fn test_interface_field_result() {
|
|||
}
|
||||
|
||||
#[async_graphql::Interface(field(name = "value", type = "FieldResult<i32>"))]
|
||||
struct Node(MyObj);
|
||||
enum Node {
|
||||
MyObj(MyObj),
|
||||
}
|
||||
|
||||
struct Query;
|
||||
|
||||
|
|
|
@ -325,7 +325,9 @@ pub async fn test_subscription_fragment() {
|
|||
}
|
||||
|
||||
#[Interface(field(name = "a", type = "i32"))]
|
||||
struct MyInterface(Event);
|
||||
enum MyInterface {
|
||||
Event(Event),
|
||||
}
|
||||
|
||||
#[Object]
|
||||
impl QueryRoot {}
|
||||
|
@ -380,7 +382,9 @@ pub async fn test_subscription_fragment2() {
|
|||
}
|
||||
|
||||
#[Interface(field(name = "a", type = "i32"))]
|
||||
struct MyInterface(Event);
|
||||
enum MyInterface {
|
||||
Event(Event),
|
||||
}
|
||||
|
||||
#[Object]
|
||||
impl QueryRoot {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user