Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(socketio): reformat test assertions for readability

Steven Enamakelda2acc46a9d1
diff --git a/src/core/socketio.rs b/src/core/socketio.rs
index a7b8832dc4..c1f568e87d 100644
--- a/src/core/socketio.rs
+++ b/src/core/socketio.rs
@@ -1600,8 +1600,7 @@ fn emit_with_aliases(socket: &SocketRef, name: &str, payload: &serde_json::Value
mod tests {
use super::{
channel_connection_update_payload, event_alias, origin_is_allowed_with_extra,
- publish_companion_state_changed,
- subscribe_companion_state_changed,
+ publish_companion_state_changed, subscribe_companion_state_changed,
};
#[test]
@@ -1678,16 +1677,34 @@ mod tests {
// - Linux / older Windows builds use `https://tauri.localhost`
// All three flavours are the same trust tier (the bundled webview),
// so each must pass the handshake gate.
- assert!(origin_is_allowed_with_extra(Some("tauri://localhost"), None));
- assert!(origin_is_allowed_with_extra(Some("https://tauri.localhost"), None));
- assert!(origin_is_allowed_with_extra(Some("http://tauri.localhost"), None));
+ assert!(origin_is_allowed_with_extra(
+ Some("tauri://localhost"),
+ None
+ ));
+ assert!(origin_is_allowed_with_extra(
+ Some("https://tauri.localhost"),
+ None
+ ));
+ assert!(origin_is_allowed_with_extra(
+ Some("http://tauri.localhost"),
+ None
+ ));
}
#[test]
fn origin_allowlist_accepts_local_dev_server() {
- assert!(origin_is_allowed_with_extra(Some("http://localhost:1420"), None));
- assert!(origin_is_allowed_with_extra(Some("http://127.0.0.1:1420"), None));
- assert!(origin_is_allowed_with_extra(Some("http://[::1]:1420"), None));
+ assert!(origin_is_allowed_with_extra(
+ Some("http://localhost:1420"),
+ None
+ ));
+ assert!(origin_is_allowed_with_extra(
+ Some("http://127.0.0.1:1420"),
+ None
+ ));
+ assert!(origin_is_allowed_with_extra(
+ Some("http://[::1]:1420"),
+ None
+ ));
// Loopback without an explicit port (some CEF builds stamp this
// shape when the shell runs on the default port).
assert!(origin_is_allowed_with_extra(Some("http://localhost"), None));
@@ -1695,8 +1712,14 @@ mod tests {
#[test]
fn origin_allowlist_rejects_cross_origin_browser_pages() {
- assert!(!origin_is_allowed_with_extra(Some("https://attacker.example"), None));
- assert!(!origin_is_allowed_with_extra(Some("http://evil.local"), None));
+ assert!(!origin_is_allowed_with_extra(
+ Some("https://attacker.example"),
+ None
+ ));
+ assert!(!origin_is_allowed_with_extra(
+ Some("http://evil.local"),
+ None
+ ));
assert!(!origin_is_allowed_with_extra(Some("null"), None));
assert!(!origin_is_allowed_with_extra(Some(""), None));
}
@@ -1705,17 +1728,23 @@ mod tests {
fn origin_allowlist_rejects_host_prefix_decoys() {
// Regression: `starts_with("localhost")` accepted these; the exact
// host match must not.
- assert!(!origin_is_allowed_with_extra(Some(
- "http://localhost.attacker.example"
- ), None));
- assert!(!origin_is_allowed_with_extra(Some(
- "http://127.0.0.1.attacker.example"
- ), None));
- assert!(!origin_is_allowed_with_extra(Some("https://localhost-evil"), None));
+ assert!(!origin_is_allowed_with_extra(
+ Some("http://localhost.attacker.example"),
+ None
+ ));
+ assert!(!origin_is_allowed_with_extra(
+ Some("http://127.0.0.1.attacker.example"),
+ None
+ ));
+ assert!(!origin_is_allowed_with_extra(
+ Some("https://localhost-evil"),
+ None
+ ));
// Same rule applies to the tauri.localhost host — must be exact.
- assert!(!origin_is_allowed_with_extra(Some(
- "http://tauri.localhost.attacker.example"
- ), None));
+ assert!(!origin_is_allowed_with_extra(
+ Some("http://tauri.localhost.attacker.example"),
+ None
+ ));
assert!(!origin_is_allowed_with_extra(
Some("https://tauri.localhost.evil"),
None