Added GraphQL query function.
This commit is contained in:
parent
4bd1a91704
commit
c70e403266
22
src/lib.rs
22
src/lib.rs
@ -5,4 +5,26 @@ impl Database {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub async fn query(&self, _qry: &str) -> String {
|
||||
"{data{}}".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod queries {
|
||||
use super::*;
|
||||
|
||||
#[async_std::test]
|
||||
async fn empty_table_query() {
|
||||
let expected = "{data{}}";
|
||||
let testdb = Database::new();
|
||||
let output = testdb.query("{tables{name}}").await;
|
||||
assert!(
|
||||
output == expected,
|
||||
"Got '{}' expected '{}'.",
|
||||
output,
|
||||
expected
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user