aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-01-18 13:27:13 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-01-18 13:27:13 +0100
commitceb8a4faf7144b81b13efed33a57655de9268640 (patch)
tree382e13141453fa07071eedc4d13f82ae3941b781 /src
parent64296ca9c83011e3de4d9f1be02335d8eb1bfe95 (diff)
Format
Diffstat (limited to 'src')
-rw-r--r--src/command/update.rs32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/command/update.rs b/src/command/update.rs
index fedec13..e415872 100644
--- a/src/command/update.rs
+++ b/src/command/update.rs
@@ -145,17 +145,16 @@ mod tests {
create_test_file(&test_file, "# I try.");
// Update 1 of 2
- update.execute(Some(&test_file_string), &configuration, "update")
+ update
+ .execute(Some(&test_file_string), &configuration, "update")
.expect("Could not update a .gmi");
assert!(&posts_dir.join("0").exists());
assert_file_contents(&posts_dir.join("0/cool-test-file-😎.gmi"), "# I try.");
- let entries = read_dir(&archive_dir)
- .expect("Could not read archive");
+ let entries = read_dir(&archive_dir).expect("Could not read archive");
let mut found_path = PathBuf::new();
for entry in entries {
- let entry = entry
- .expect("Could not read entry");
+ let entry = entry.expect("Could not read entry");
found_path = entry.path();
assert_file_contents(&found_path.join("cool-test-file-😎.gmi"), "# I try.");
assert!(&found_path.join("metadata.json").exists());
@@ -167,10 +166,17 @@ mod tests {
create_test_file(&second_test_file, "# I REALLY try.");
// Update 2 of 2
- update.execute(Some(&second_test_file_string), &configuration, "update")
+ update
+ .execute(Some(&second_test_file_string), &configuration, "update")
.expect("Could not update a .gmi");
- assert_file_contents(&posts_dir.join("0/cooler-test-file-😎.gmi"), "# I REALLY try.");
- assert_file_contents(&found_path.join("cooler-test-file-😎.gmi"), "# I REALLY try.");
+ assert_file_contents(
+ &posts_dir.join("0/cooler-test-file-😎.gmi"),
+ "# I REALLY try.",
+ );
+ assert_file_contents(
+ &found_path.join("cooler-test-file-😎.gmi"),
+ "# I REALLY try.",
+ );
cleanup_test_dir(&test_dir);
}
@@ -186,7 +192,7 @@ mod tests {
// Create metadata
let metadata = Metadata {
id: "1234".to_string(),
- created_on: 1234
+ created_on: 1234,
};
// Update 1 of 2
@@ -214,11 +220,13 @@ mod tests {
create_test_file(&test_file, "# Unlike a Bird");
create_test_file(&nested_test_file, "# Very much like a Bird");
- Update::archive(&source_dir, &target_dir)
- .expect("Could not archive the test directories");
+ Update::archive(&source_dir, &target_dir).expect("Could not archive the test directories");
assert_file_contents(&target_dir.join("not_nested.gmi"), "# Unlike a Bird");
- assert_file_contents(&target_dir.join("nested/very_much_nested.gmi"), "# Very much like a Bird");
+ assert_file_contents(
+ &target_dir.join("nested/very_much_nested.gmi"),
+ "# Very much like a Bird",
+ );
cleanup_test_dir(&test_dir);
}