feat(examples): add workout replay e2e
Wrap the workout page with the shared runtime, add export replay over command/event truth, and cover the running HTTP app with an end-to-end test that exercises runtime asset loading and product interactions. req: examples/001 req: local/001 req: local/003 req: local/004 req: host/001
This commit is contained in:
@@ -22,7 +22,7 @@ async fn main() {
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
fn app(state: AppState) -> Router {
|
||||
pub fn app(state: AppState) -> Router {
|
||||
Router::new()
|
||||
.route("/", get(page).post(interact))
|
||||
.route(runtime_js_path(), get(runtime))
|
||||
@@ -30,7 +30,9 @@ fn app(state: AppState) -> Router {
|
||||
}
|
||||
|
||||
async fn page(State(state): State<AppState>) -> impl IntoResponse {
|
||||
axum::response::Html(state.with_workout(|workout| workout_app::render(workout).into_string()))
|
||||
axum::response::Html(
|
||||
state.with_workout(|workout| workout_app::page(runtime_js_path(), workout).into_string()),
|
||||
)
|
||||
}
|
||||
|
||||
async fn interact(
|
||||
@@ -63,6 +65,10 @@ async fn interact(
|
||||
)
|
||||
}
|
||||
})
|
||||
.on(workout::replay_export, {
|
||||
let state = state.clone();
|
||||
move |_| workout_app::replay_export(&state)
|
||||
})
|
||||
.on(workout::export_log, {
|
||||
let state = state.clone();
|
||||
move |_| workout_app::export_log(&state)
|
||||
|
||||
Reference in New Issue
Block a user