Files
radicle-desktop/crates/test-http-api/src/lib.rs
T
Rūdolfs Ošiņš b0a519d1c5 Mirror every Tauri command in test-http-api
Several commands had no route or returned stubs, so e2e tests silently got
null or empty data. A missing route now fails loudly, the profile loads on
first use so onboarding works, and node status is polled over HTTP. A
parity test keeps the routes from drifting from the Tauri handlers again;
it also caught revisions_by_patch being registered twice.
2026-10-01 18:16:29 +02:00

23 lines
593 B
Rust

use std::net::SocketAddr;
use tokio::net::TcpListener;
mod api;
#[derive(Debug, Clone)]
pub struct Options {
pub listen: SocketAddr,
}
pub async fn run(options: Options) -> anyhow::Result<()> {
let listener = TcpListener::bind(options.listen).await?;
// Read by the e2e harness to learn the port when it asked for port 0.
println!("listening on {}", listener.local_addr()?);
let app =
api::router(api::Shared::default()).into_make_service_with_connect_info::<SocketAddr>();
axum::serve(listener, app)
.await
.map_err(anyhow::Error::from)
}