Clean up tests
This commit is contained in:
parent
e4fe60c06e
commit
32bbe8a8ce
2 changed files with 30 additions and 30 deletions
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
|
@ -27,8 +27,3 @@ impl TryFrom<&str> for ElementContent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test() {
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue