sal-modular/vault/tests/wasm_session_manager.rs
Sameh Abouelsaad 13945a8725 feat: Add WASM support and browser extension infrastructure
- Add WASM build target and dependencies for all crates.
- Implement IndexedDB-based persistent storage for WASM.
- Create browser extension infrastructure (UI, scripting, etc.).
- Integrate Rhai scripting engine for secure automation.
- Implement user stories and documentation for the extension.
2025-05-16 15:31:53 +03:00

30 lines
1.3 KiB
Rust

// This file contains WASM-only tests for session manager logic in the vault crate.
// All code is strictly separated from native using cfg attributes.
#![cfg(target_arch = "wasm32")]
//! WASM test for session manager logic in the vault crate.
use wasm_bindgen_test::*;
use vault::session::SessionManager;
use vault::Vault;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test(async)]
async fn test_session_manager_end_to_end() {
// Example: test session manager logic in WASM
// This is a placeholder for your real test logic.
// All imports are WASM-specific and local to the test function
use kvstore::wasm::WasmStore;
use vault::session::SessionManager;
let store = WasmStore::open("testdb_wasm_session_manager").await.unwrap();
let vault = Vault::new(store);
let mut manager = SessionManager::new(vault);
let keyspace = "testspace";
// This test can only check session initialization/select_keyspace logic as SessionManager does not create keypairs directly.
// manager.select_keyspace(keyspace) would fail unless the keyspace exists.
// For a true end-to-end test, use Vault to create the keyspace and keypair, then test SessionManager.
// For now, just test that SessionManager can be constructed.
assert!(manager.current_keyspace().is_none());
}