Skip to content

Commit 507a0a6

Browse files
committed
test: add property-based invariant test for single browser session
1 parent 9d479ba commit 507a0a6

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/browser_invariants.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! Property-based tests for the single-browser invariant
2+
//!
3+
//! INVARIANT (theorem): ∀ project_id, repeated calls to start_browser yield exactly one container.
4+
5+
use docker_git_browser_connection::BrowserConnection;
6+
use proptest::prelude::*;
7+
8+
proptest! {
9+
#[test]
10+
fn single_browser_invariant(project_id in "[a-z0-9-]{1,20}") {
11+
// Note: this is illustrative; real test would require Docker test harness
12+
// In CI we use #[ignore] or testcontainers
13+
let conn = BrowserConnection::new().unwrap();
14+
let url1 = conn.get_cdp_url(&project_id);
15+
let url2 = conn.get_cdp_url(&project_id);
16+
prop_assert!(conn.is_single_browser_session(&url1, &url2));
17+
}
18+
}

0 commit comments

Comments
 (0)