use tokio_util::sync::CancellationToken;
use super::*;
#[tokio::test]
async fn watch_returns_ok_on_immediate_shutdown() {
let token = CancellationToken::new();
token.cancel();
let result = watch(
std::path::PathBuf::from("/tmp"),
token,
|_config| { },
)
.await;
assert!(result.is_ok(), "expected Ok(()), got: {:?}", result.err());
}
#[tokio::test]
async fn watch_returns_error_for_nonexistent_path() {
let token = CancellationToken::new();
token.cancel();
let result = watch(
std::path::PathBuf::from("/nonexistent/path/config.yaml"),
token,
|_config| {},
)
.await;
assert!(
result.is_err(),
"expected an error for nonexistent path, got Ok"
);
}