test /read API for empty project

This commit is contained in:
Lucien Greathouse 2018-06-06 00:07:20 -07:00
parent 565bed2b9d
commit 9af6c9cfd9
3 changed files with 23 additions and 5 deletions

View file

@ -13,7 +13,7 @@ use std::path::PathBuf;
use librojo::{
session::Session,
project::Project,
web::{Server, WebConfig, ServerInfoResponse, ReadAllResponse},
web::{Server, WebConfig, ServerInfoResponse, ReadResponse, ReadAllResponse},
};
#[test]
@ -48,4 +48,13 @@ fn empty() {
assert_eq!(response.message_cursor, -1);
assert_eq!(response.instances.as_ref(), &HashMap::new());
}
{
let body = server.get_string("/api/read/0");
let response = serde_json::from_str::<ReadResponse>(&body).unwrap();
assert_eq!(response.server_id, "0");
assert_eq!(response.message_cursor, -1);
assert_eq!(response.instances, HashMap::new());
}
}