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) ); }