rojo-test: Add disabled test for moving big folder of stuff

This commit is contained in:
Lucien Greathouse
2019-10-17 16:03:21 -07:00
parent e55b72f73f
commit e2e9209655
2 changed files with 48 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
use std::fs;
use insta::assert_yaml_snapshot;
use tempfile::tempdir;
use crate::{internable::InternAndRedact, serve_util::run_serve_test};
@@ -99,3 +100,50 @@ fn add_folder() {
);
});
}
#[test]
#[ignore]
fn move_folder_of_stuff() {
run_serve_test("move_folder_of_stuff", |session, mut redactions| {
let info = session.get_api_rojo().unwrap();
let root_id = info.root_instance_id;
assert_yaml_snapshot!("move_folder_of_stuff_info", redactions.redacted_yaml(info));
let read_response = session.get_api_read(root_id).unwrap();
assert_yaml_snapshot!(
"move_folder_of_stuff_all",
read_response.intern_and_redact(&mut redactions, root_id)
);
// Create a directory full of stuff we can move in
let src_dir = tempdir().unwrap();
let stuff_path = src_dir.path().join("new-stuff");
fs::create_dir(&stuff_path).unwrap();
// Make a bunch of random files in our stuff folder
for i in 0..10 {
let file_name = stuff_path.join(format!("{}.txt", i));
let file_contents = format!("File #{}", i);
fs::write(file_name, file_contents).unwrap();
}
// We're hoping that this rename gets picked up as one event. This test
// will fail otherwise.
fs::rename(stuff_path, session.path().join("new-stuff")).unwrap();
let subscribe_response = session.get_api_subscribe(0).unwrap();
assert_yaml_snapshot!(
"move_folder_of_stuff_subscribe",
subscribe_response.intern_and_redact(&mut redactions, ())
);
let read_response = session.get_api_read(root_id).unwrap();
assert_yaml_snapshot!(
"move_folder_of_stuff_all-2",
read_response.intern_and_redact(&mut redactions, root_id)
);
});
}