From f229445c3d26fc4a7c76e068859677908b1d232b Mon Sep 17 00:00:00 2001 From: ddidderr Date: Fri, 22 May 2026 07:07:06 +0200 Subject: [PATCH] test(gateway): cover visible iface alias help The MVP test guide relies on --iface being both accepted and discoverable from lanparty-gateway --help. The parser test already covered acceptance, but it did not protect the rendered help text. Render the Clap long help in a unit test and assert that the visible alias is advertised. This keeps the handoff guide and binary self-documentation aligned. Test Plan: - cargo fmt --check - cargo test -p lanparty-gateway iface_alias - cargo run -p lanparty-gateway -- --help - cargo test --workspace - cargo clippy --workspace --all-targets -- -D warnings - git diff --check - git diff --cached --check Refs: MVP gateway test handoff --- crates/lanparty-gateway/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/lanparty-gateway/src/lib.rs b/crates/lanparty-gateway/src/lib.rs index 7fcc5ae..7aada5c 100644 --- a/crates/lanparty-gateway/src/lib.rs +++ b/crates/lanparty-gateway/src/lib.rs @@ -1045,6 +1045,7 @@ mod tests { use std::time::Duration; use bytes::Bytes; + use clap::CommandFactory; use lanparty_net::DEFAULT_RELAY_PORT; use quinn::{ServerConfig, TransportConfig, crypto::rustls::QuicServerConfig}; use rustls::pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer}; @@ -1121,6 +1122,19 @@ mod tests { assert_eq!(args.interface, "eth0"); } + #[test] + fn shows_iface_alias_in_help() { + let mut command = GatewayArgs::command(); + let mut help = Vec::new(); + command.write_long_help(&mut help).unwrap(); + let help = String::from_utf8(help).unwrap(); + + assert!( + help.contains("[aliases: --iface]"), + "gateway help should advertise --iface alias:\n{help}" + ); + } + #[tokio::test] async fn connects_to_relay_control_stream_as_gateway() { let (server_config, certificate) = test_server_config();