async-graphql/tests/mut_args.rs

24 lines
510 B
Rust
Raw Normal View History

2020-08-17 13:48:53 +00:00
use async_graphql::*;
#[tokio::test]
2020-08-17 13:48:53 +00:00
pub async fn test_mut_args() {
struct Query;
#[Object]
2020-08-17 13:48:53 +00:00
impl Query {
async fn test(&self, mut a: i32, mut b: String) -> String {
a += 1;
b += "a";
format!("{}{}", a, b)
}
}
let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();
assert_eq!(
2020-09-10 11:35:48 +00:00
schema.execute("{ test(a: 10, b: \"abc\") }").await.data,
value!({
2020-08-17 13:48:53 +00:00
"test": "11abca"
})
);
}