Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] a1fb8ac9ab Merge main (e7b67fb0) into the pull request
Resolved both conflicts. In Cargo.toml I kept main's reduced web-sys fea

Resolved both conflicts. In Cargo.toml I kept main's reduced web-sys feature list and the PR's wasm32-only wasm-bindgen-test dev-dependency. Main moved the web services code out of web.rs, so I took main's side there and kept the PR's wasm_smoke_tests module at the end of the file. The test module now imports deckcraft_engine::Session explicitly, because it no longer comes in through `use super::*`. Cargo.lock already has the dependency edge. I couldn't build or run tests offline: the git-pinned egui dependency can't be fetched.
2026-12-02 18:34:25 +00:00
aiongg 115070fbb9 Merge main into dc-build-d524 2026-11-05 05:02:52 +00:00
aiongg d276e5df1d Apply review fixes
- apps/deckcraft-web/src/web.rs
2026-11-04 23:20:32 +00:00
Harrison Booth 657686d623 fix: initialize presentation in wasm smoke test 2026-11-03 16:32:18 -06:00
Harrison Booth 873b46a85b Merge origin/main into web presenter 2026-11-03 10:35:07 -06:00
Harrison Booth 9c600da847 WASM: smoke-test malformed commands as errors 2026-10-30 18:39:19 -05:00
3 changed files with 29 additions and 0 deletions
Generated
+1
View File
@@ -2692,6 +2692,7 @@ dependencies = [
"serde_json",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test",
"web-sys",
]
+3
View File
@@ -29,3 +29,6 @@ wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlCanvasElement", "Location", "UrlSearchParams"] }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"
+25
View File
@@ -214,3 +214,28 @@ impl eframe::App for WebShell {
self.app.ui(ui);
}
}
#[cfg(test)]
mod wasm_smoke_tests {
use deckcraft_engine::Session;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
// Run with wasm-bindgen-test-runner in a real browser. wasm panic=abort means a panic here
// would stop the test process; the hostile requests below must return Results instead.
#[wasm_bindgen_test::wasm_bindgen_test]
fn malformed_commands_return_errors_and_the_session_remains_usable() {
let mut session = Session::new();
assert!(session.execute("file.new", &serde_json::json!({})).is_ok(), "a presentation must be active before shape commands");
let bad_font = session.execute("font.add", &serde_json::json!({"data": "AAAA"}));
assert!(bad_font.is_err(), "invalid font data must return an error");
let bad_geometry = session.execute("shape.insert", &serde_json::json!({"preset": "not-a-shape"}));
assert!(bad_geometry.is_err(), "unknown geometry must return an error");
let valid = session.execute("shape.insert", &serde_json::json!({"preset": "rect", "rect": [0, 0, 10, 10]}));
assert!(valid.is_ok(), "a valid command must still work after malformed requests");
}
}