mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
rojo-test: Add disabled test for moving big folder of stuff
This commit is contained in:
0
rojo-test/serve-tests/move_folder_of_stuff/.gitkeep
Normal file
0
rojo-test/serve-tests/move_folder_of_stuff/.gitkeep
Normal file
@@ -1,6 +1,7 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use insta::assert_yaml_snapshot;
|
use insta::assert_yaml_snapshot;
|
||||||
|
use tempfile::tempdir;
|
||||||
|
|
||||||
use crate::{internable::InternAndRedact, serve_util::run_serve_test};
|
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)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user