reorg
This commit is contained in:
22
kordophone/src/tests/mod.rs
Normal file
22
kordophone/src/tests/mod.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
mod test_client;
|
||||
use self::test_client::TestClient;
|
||||
use crate::APIInterface;
|
||||
|
||||
pub mod api_interface {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
let client = TestClient{};
|
||||
let version = client.get_version();
|
||||
assert_eq!(version, "KordophoneTest-1.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_conversations() {
|
||||
let client = TestClient{};
|
||||
let conversations = client.get_conversations();
|
||||
assert_eq!(conversations.len(), 1);
|
||||
assert_eq!(conversations[0].display_name, Some("Test Conversation".to_string()));
|
||||
}
|
||||
}
|
||||
16
kordophone/src/tests/test_client.rs
Normal file
16
kordophone/src/tests/test_client.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
pub use crate::APIInterface;
|
||||
use crate::model::Conversation;
|
||||
|
||||
pub struct TestClient {}
|
||||
|
||||
impl APIInterface for TestClient {
|
||||
fn get_version(&self) -> String {
|
||||
return "KordophoneTest-1.0".to_string()
|
||||
}
|
||||
|
||||
fn get_conversations(&self) -> Vec<Conversation> {
|
||||
let mut conversations = Vec::new();
|
||||
conversations.push(Conversation::builder().display_name("Test Conversation").build());
|
||||
conversations
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user