// Integration contract between the protobuf API and server implementation. // // Scope: compare the generated service surface contract with the relay handler // implementation files that dispatch each RPC. // Targets: `common/proto/lesavka.proto` and `server/src/main/relay_service.rs`. // Why: client and server can compile independently while still drifting at the // protocol boundary; this test keeps the end-to-end RPC seam visible. const PROTO: &str = include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/common/proto/lesavka.proto" )); const RELAY_SERVICE: &str = include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/server/src/main/relay_service.rs" )); const HANDSHAKE_SERVICE: &str = include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/server/src/handshake.rs" )); #[test] fn proto_rpc_surface_has_matching_relay_dispatch_methods() { for (rpc, method) in [ ("StreamKeyboard", "stream_keyboard_rpc"), ("StreamMouse", "stream_mouse_rpc"), ("CaptureVideo", "capture_video_rpc"), ("CaptureAudio", "capture_audio_rpc"), ("StreamMicrophone", "stream_microphone_rpc"), ("StreamCamera", "stream_camera_rpc"), ("StreamWebcamMedia", "stream_webcam_media_rpc"), ("RunOutputDelayProbe", "run_output_delay_probe_rpc"), ("PasteText", "paste_text_rpc"), ("RecoverUsb", "recover_usb_rpc"), ("RecoverUac", "recover_uac_rpc"), ("RecoverUvc", "recover_uvc_rpc"), ] { assert!( PROTO.contains(&format!("rpc {rpc}")), "missing proto RPC {rpc}" ); assert!( RELAY_SERVICE.contains(method), "relay service should dispatch {rpc} through {method}" ); } assert!( PROTO.contains("rpc GetCapabilities") && HANDSHAKE_SERVICE.contains("get_capabilities"), "handshake service should implement the GetCapabilities API" ); }