mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -51,47 +51,3 @@ pub(crate) fn sha256_file(path: &Path) -> Result<String> {
|
||||
fs::File::open(path).with_context(|| format!("Failed to open {}", path.display()))?;
|
||||
sha256_reader(file).with_context(|| format!("Failed to read {}", path.display()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn remove_file_if_exists_removes_files_and_ignores_missing_paths() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("artifact.txt");
|
||||
fs::write(&path, "artifact").unwrap();
|
||||
|
||||
remove_file_if_exists(&path).unwrap();
|
||||
remove_file_if_exists(&path).unwrap();
|
||||
|
||||
assert!(!path.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_dir_if_exists_removes_directories_and_ignores_missing_paths() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("dist");
|
||||
fs::create_dir_all(path.join("nested")).unwrap();
|
||||
fs::write(path.join("nested").join("artifact.txt"), "artifact").unwrap();
|
||||
|
||||
remove_dir_if_exists(&path).unwrap();
|
||||
remove_dir_if_exists(&path).unwrap();
|
||||
|
||||
assert!(!path.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn write_json_pretty_creates_parent_directories_and_writes_pretty_json() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("nested").join("manifest.json");
|
||||
|
||||
write_json_pretty(&path, &json!({ "name": "fluxer", "version": 1 })).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
fs::read_to_string(path).unwrap(),
|
||||
"{\n \"name\": \"fluxer\",\n \"version\": 1\n}\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user