Clean up tests

This commit is contained in:
Philip (a-0) 2023-12-07 21:54:24 +01:00
parent e4fe60c06e
commit 32bbe8a8ce
2 changed files with 30 additions and 30 deletions

View file

@ -106,30 +106,35 @@ impl State {
}
#[cfg(test)]
mod tests {
use crate::state::State;
use crate::state::types::ElementContent;
#[tokio::test]
#[serial_test::serial]
async fn test_create() {
tracing_subscriber::fmt().pretty().init();
let state = State::new().await.unwrap();
let id = state.create_element(&ElementContent::Text("Test-text".to_string())).unwrap();
let el = state.get_element(&id).unwrap();
assert_eq!(
ElementContent::Text("Test-text".to_string()),
el.content().to_owned()
)
}
#[tokio::test]
#[serial_test::serial]
async fn test_create() {
tracing_subscriber::fmt().pretty().init();
let state = State::new().await.unwrap();
let id = state.create_element(&ElementContent::Text("Test-text".to_string())).unwrap();
let el = state.get_element(&id).unwrap();
assert_eq!(
ElementContent::Text("Test-text".to_string()),
el.content().to_owned()
)
}
#[tokio::test]
#[serial_test::serial]
async fn test_update() {
tracing_subscriber::fmt().pretty().init();
let state = State::new().await.unwrap();
let id = state.create_element(&ElementContent::Text("Test-text".to_string())).unwrap();
state.set_element(&id,&ElementContent::Text("Test-text 2".to_string())).unwrap();
let el = state.get_element(&id).unwrap();
assert_eq!(
ElementContent::Text("Test-text 2".to_string()),
el.content().to_owned()
)
#[tokio::test]
#[serial_test::serial]
async fn test_update() {
tracing_subscriber::fmt().pretty().init();
let state = State::new().await.unwrap();
let id = state.create_element(&ElementContent::Text("Test-text".to_string())).unwrap();
state.set_element(&id,&ElementContent::Text("Test-text 2".to_string())).unwrap();
let el = state.get_element(&id).unwrap();
assert_eq!(
ElementContent::Text("Test-text 2".to_string()),
el.content().to_owned()
)
}
}

View file

@ -27,8 +27,3 @@ impl TryFrom<&str> for ElementContent {
}
}
}
#[test]
pub fn test() {
}