mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 11:20:36 +08:00
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.
36 lines
806 B
Rust
36 lines
806 B
Rust
use std::process;
|
|
|
|
use test_http_api as api;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let options = parse_options()?;
|
|
match api::run(options).await {
|
|
Ok(()) => {}
|
|
Err(_) => {
|
|
process::exit(1);
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn parse_options() -> Result<api::Options, lexopt::Error> {
|
|
use lexopt::prelude::*;
|
|
|
|
let mut parser = lexopt::Parser::from_env();
|
|
let mut listen = None;
|
|
|
|
while let Some(arg) = parser.next()? {
|
|
match arg {
|
|
Long("listen") => {
|
|
let addr = parser.value()?.parse()?;
|
|
listen = Some(addr);
|
|
}
|
|
_ => return Err(arg.unexpected()),
|
|
}
|
|
}
|
|
Ok(api::Options {
|
|
listen: listen.unwrap_or_else(|| ([127, 0, 0, 1], 8081).into()),
|
|
})
|
|
}
|