blob: 919ba0170f900fa64d306e50bc5dc5533b49cadf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#[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);
}
}
|