From ee25441be75758afd2d513e33f92e25078466837 Mon Sep 17 00:00:00 2001 From: slhx agent Date: Tue, 2 Jun 2026 00:33:23 +0200 Subject: [PATCH] test(axum): exercise interaction helper path Move public axum response tests off direct HandlerRegistry construction so the checked test surface follows interactions()/on() just like canonical examples. req: axum_integration/003 req: ceremony/001 req: dx/003 --- slhx-axum/tests/response.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/slhx-axum/tests/response.rs b/slhx-axum/tests/response.rs index 9d3b80d..7c58116 100644 --- a/slhx-axum/tests/response.rs +++ b/slhx-axum/tests/response.rs @@ -2,7 +2,7 @@ use axum::http::{header, HeaderMap}; use axum::response::IntoResponse; use scraper::{Html, Selector}; use slhx_axum::{ - interactions, runtime_js, DispatchRejection, EffectResponse, HandlerRegistry, InteractionForm, + interactions, runtime_js, DispatchRejection, EffectResponse, InteractionForm, InteractionFormRejection, InteractionRequest, PageMode, PageRequest, PageResponse, SLHX_CONTENT_TYPE, SLHX_FINGERPRINT_HEADER, SLHX_PARTIAL_HEADER, SLHX_RUNTIME_CONTENT_TYPE, SLHX_TITLE_HEADER, @@ -169,16 +169,19 @@ fn interaction_request_dispatches_with_concise_handlers_helper() { } #[test] -fn handler_registry_dispatches_by_checked_handle() { +fn interactions_dispatch_by_checked_handle() { // req: ceremony/004 req: public_api/001 let title = Slot::::new(7); let create = Handle::<()>::new(42); - let registry = HandlerRegistry::new(BuildFingerprint(123)).register_handle(create, move |form| { - title.text(form.value("title").unwrap_or("")) - }); + let request = InteractionRequest::from(InteractionForm::for_handle( + create, + [("title".into(), "Hello".into())], + )); - let response = registry - .dispatch(InteractionForm::for_handle(create, [("title".into(), "Hello".into())])) + let response = request + .dispatch(interactions(BuildFingerprint(123)).on(create, move |form| { + title.text(form.value("title").unwrap_or("")) + })) .unwrap(); assert_eq!(response.batch.fingerprint, BuildFingerprint(123)); @@ -186,11 +189,11 @@ fn handler_registry_dispatches_by_checked_handle() { } #[test] -fn handler_registry_rejects_unknown_handle_ids() { - let registry = HandlerRegistry::new(BuildFingerprint(123)); +fn interactions_reject_unknown_handle_ids() { + let request = InteractionRequest::from(InteractionForm::new(9, [])); assert_eq!( - registry.dispatch(InteractionForm::new(9, [])).unwrap_err(), + request.dispatch(interactions(BuildFingerprint(123))).unwrap_err(), DispatchRejection::UnknownHandle(9) ); }