#[cfg(test)] mod tests { use crate::validator::Validator; use crate::models::Post; use serde_json; #[test] fn test_post_schemas_correspondence() { let p = Post { id: 0, title: "Title".to_string(), body: "Body".to_string(), published: true, hidden: false }; let v = Validator::from_file("schemas/post.json").unwrap(); let json = serde_json::to_string(&p).unwrap(); assert_eq!(v.check(&json), true); } }