This repository has been archived on 2026-10-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
maestro/crates/maestro-daemon/tests/embedded_bundle.rs
T
Miguel PalhasandClaude Opus 4.6 beef2049ed
ci / rust (push) Failing after 6s
ci / web (push) Successful in 37s
ci / flake (push) Failing after 53s
fix(maestro): update remaining id="app" references in web tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-09-10 16:02:02 +01:00

32 lines
1.2 KiB
Rust

//! The daemon binary must embed the real SPA bundle, never the placeholder.
//! `build.rs` guarantees `web/dist` is populated before `include_dir!` runs.
#![cfg(feature = "web")]
use axum::body::to_bytes;
use maestro_daemon::static_bundle::serve_index;
#[tokio::test]
async fn embedded_index_is_real_spa_not_placeholder() {
let resp = serve_index();
let body = to_bytes(resp.into_body(), usize::MAX).await.unwrap();
let html = String::from_utf8(body.to_vec()).unwrap();
assert!(
html.contains(r#"id="root""#),
"served index is missing the SPA mount point; got:\n{html}"
);
assert!(
!html.contains("maestro is running"),
"served index is the placeholder, not the built bundle"
);
// Stronger signal than `id="root"` (which appears in both source and built
// HTML): the vite build rewrites the entry to a hashed `/assets/index-<hash>`
// bundle, whereas the un-built source references `/src/main.ts`. This catches
// both an empty/placeholder embed and the staleness case.
assert!(
html.contains("/assets/index-"),
"served index does not reference a vite-built hashed asset; got:\n{html}"
);
}