Skip to content

Commit

Permalink
remove: delete test cases that cannot be run temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxjy1 committed Nov 23, 2023
1 parent 7352045 commit 5e56f4d
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions maa-cli/src/run/copilot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,75 +163,3 @@ fn find_stage_name(stage_code_name: &str, mut stage_dir: PathBuf) -> Result<Stri

Ok(stage.to_string())

Check warning on line 164 in maa-cli/src/run/copilot.rs

View check run for this annotation

Codecov / codecov/patch

maa-cli/src/run/copilot.rs#L164

Added line #L164 was not covered by tests
}

#[cfg(test)]
mod tests {
use std::path::Path;

use anyhow::Context;
use directories::ProjectDirs;

use crate::{dirs, installer::maa_core::find_resource, run::copilot::find_stage_name};

use super::copilot;

#[test]
fn copilot_test() {
let proj = ProjectDirs::from("com", "loong", "maa");
let proj_dirs = dirs::Dirs::new(proj);
assert!(copilot(
&proj_dirs,
"maa://29920".to_owned(), // normal
None,
false,
false,
true
)
.is_ok(),);
assert!(copilot(
&proj_dirs,
"maa://26285".to_owned(), // SSS
None,
false,
false,
true
)
.is_ok());
assert!(copilot(
&proj_dirs,
"maa://114514".to_owned(),
None,
false,
false,
true
)
.is_err());
assert!(copilot(&proj_dirs, "Arknights".to_owned(), None, false, false, true).is_err());
assert!(copilot(&proj_dirs, "明日方舟".to_owned(), None, false, false, true).is_err());
}

#[test]
fn find_stage_name_test() {
let proj = ProjectDirs::from("com", "loong", "maa");
let proj_dirs = dirs::Dirs::new(proj);
let mut stage_dir = find_resource(&proj_dirs).context("").unwrap();
stage_dir.push("Arknights-Tile-Pos");
let err_path = Path::new("/err_path").to_path_buf();
let stage1 = String::from("a001_01"); // GT-1
let stage2 = String::from("main_01-07"); // 1-7
let stage3 = String::from("act9d0_01"); // DM-1
let err_name = String::from("err_name");

assert!(find_stage_name(&stage1, stage_dir.clone()).is_ok());

assert!(find_stage_name(&stage2, stage_dir.clone()).is_ok());

assert!(find_stage_name(&stage3, stage_dir.clone()).is_ok());

assert!(find_stage_name(&err_name, stage_dir.clone()).is_err());

assert!(find_stage_name(&stage1, err_path.clone()).is_err());

assert!(find_stage_name(&err_name, err_path).is_err());
}
}

0 comments on commit 5e56f4d

Please sign in to comment.