Private
Public Access
1
0

Fix tests

This commit is contained in:
2024-04-21 23:09:37 -07:00
parent 3e878ced4e
commit 48dcf9daca
4 changed files with 406 additions and 19 deletions

View File

@@ -1,16 +1,34 @@
use async_trait::async_trait;
pub use crate::APIInterface;
use crate::model::Conversation;
pub struct TestClient {}
pub struct TestClient {
pub version: &'static str,
pub conversations: Vec<Conversation>,
}
impl APIInterface for TestClient {
fn get_version(&self) -> String {
return "KordophoneTest-1.0".to_string()
}
#[derive(Debug)]
pub enum TestError {}
fn get_conversations(&self) -> Vec<Conversation> {
let mut conversations = Vec::new();
conversations.push(Conversation::builder().display_name("Test Conversation").build());
conversations
impl TestClient {
pub fn new() -> TestClient {
TestClient {
version: "KordophoneTest-1.0",
conversations: vec![],
}
}
}
#[async_trait]
impl APIInterface for TestClient {
type Error = TestError;
async fn get_version(&self) -> Result<String, Self::Error> {
Ok(self.version.to_string())
}
async fn get_conversations(&self) -> Result<Vec<Conversation>, Self::Error> {
Ok(self.conversations.clone())
}
}