Files
codex/codex-rs/external-agent-migration/src/scope_tests.rs
T
charlesgong-openai e7efc5b04b Move external agent migration into its crate (#33456)
## What changed

- Move migration detection, import orchestration, models, and reporting from
  `codex-app-server` into `codex-external-agent-migration`.
- Keep app-server protocol conversion in a dedicated boundary module.
- Organize source-specific configuration, sessions, hooks, plugins, commands,
  subagents, and memory handling behind shared migration adapters.
- Relocate and split the migration tests alongside the extracted service.

GitOrigin-RevId: 3378ec2064806a28136d6ac98664ca1d75414a4e
2026-07-16 00:34:36 +00:00

36 lines
985 B
Rust

use super::MigrationScope;
use pretty_assertions::assert_eq;
#[test]
fn missing_cwd_selects_home_scope() {
assert_eq!(
MigrationScope::from_cwd(/*cwd*/ None).expect("resolve scope"),
Some(MigrationScope::Home)
);
}
#[test]
fn nested_cwd_selects_repository_root() {
let root = tempfile::tempdir().expect("tempdir");
std::fs::create_dir(root.path().join(".git")).expect("create git directory");
let nested = root.path().join("src").join("nested");
std::fs::create_dir_all(&nested).expect("create nested directory");
assert_eq!(
MigrationScope::from_cwd(Some(&nested)).expect("resolve scope"),
Some(MigrationScope::Repository {
root: root.path().to_path_buf(),
})
);
}
#[test]
fn nonexistent_cwd_has_no_scope() {
let root = tempfile::tempdir().expect("tempdir");
assert_eq!(
MigrationScope::from_cwd(Some(&root.path().join("missing"))).expect("resolve scope"),
None
);
}