story-kit: merge 127_story_test_coverage_http_mod_rs
This commit is contained in:
@@ -150,4 +150,37 @@ mod tests {
|
|||||||
remove_port_file(&path);
|
remove_port_file(&path);
|
||||||
assert!(!path.exists());
|
assert!(!path.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn write_port_file_returns_none_on_nonexistent_dir() {
|
||||||
|
let bad = std::path::Path::new("/this_dir_does_not_exist_storykit_test_xyz");
|
||||||
|
assert!(write_port_file(bad, 1234).is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn remove_port_file_does_not_panic_for_missing_file() {
|
||||||
|
let path = std::path::Path::new("/tmp/nonexistent_storykit_port_test_xyz_999");
|
||||||
|
remove_port_file(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resolve_port_returns_a_valid_port() {
|
||||||
|
// Exercises the resolve_port code path (reads STORYKIT_PORT env var or defaults).
|
||||||
|
let port = resolve_port();
|
||||||
|
assert!(port > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn build_openapi_service_constructs_without_panic() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let ctx = Arc::new(context::AppContext::new_test(tmp.path().to_path_buf()));
|
||||||
|
let (_api_service, _docs_service) = build_openapi_service(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn build_routes_constructs_without_panic() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let ctx = context::AppContext::new_test(tmp.path().to_path_buf());
|
||||||
|
let _endpoint = build_routes(ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user