diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 19:58:41 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 19:58:41 +0000 |
| commit | b28a356cb41077ccee12a9c52f4ef2054e76cac6 (patch) | |
| tree | 2a0867f1ab0216e86efa062aef90b2b8077e6fb9 /src/sync/relay_connection.rs | |
| parent | 6dd9fcd5392891b0ddb7894e2c5cb40450eae00e (diff) | |
chore: cargo fmt
Diffstat (limited to 'src/sync/relay_connection.rs')
| -rw-r--r-- | src/sync/relay_connection.rs | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/sync/relay_connection.rs b/src/sync/relay_connection.rs index d0090c8..b86d298 100644 --- a/src/sync/relay_connection.rs +++ b/src/sync/relay_connection.rs | |||
| @@ -526,31 +526,46 @@ mod tests { | |||
| 526 | #[test] | 526 | #[test] |
| 527 | fn test_normalize_url_with_wss_scheme() { | 527 | fn test_normalize_url_with_wss_scheme() { |
| 528 | let url = "wss://relay.example.com"; | 528 | let url = "wss://relay.example.com"; |
| 529 | assert_eq!(RelayConnection::normalize_url(url), "wss://relay.example.com"); | 529 | assert_eq!( |
| 530 | RelayConnection::normalize_url(url), | ||
| 531 | "wss://relay.example.com" | ||
| 532 | ); | ||
| 530 | } | 533 | } |
| 531 | 534 | ||
| 532 | #[test] | 535 | #[test] |
| 533 | fn test_normalize_url_with_ws_scheme() { | 536 | fn test_normalize_url_with_ws_scheme() { |
| 534 | let url = "ws://relay.example.com"; | 537 | let url = "ws://relay.example.com"; |
| 535 | assert_eq!(RelayConnection::normalize_url(url), "ws://relay.example.com"); | 538 | assert_eq!( |
| 539 | RelayConnection::normalize_url(url), | ||
| 540 | "ws://relay.example.com" | ||
| 541 | ); | ||
| 536 | } | 542 | } |
| 537 | 543 | ||
| 538 | #[test] | 544 | #[test] |
| 539 | fn test_normalize_url_without_scheme() { | 545 | fn test_normalize_url_without_scheme() { |
| 540 | let url = "relay.example.com"; | 546 | let url = "relay.example.com"; |
| 541 | assert_eq!(RelayConnection::normalize_url(url), "wss://relay.example.com"); | 547 | assert_eq!( |
| 548 | RelayConnection::normalize_url(url), | ||
| 549 | "wss://relay.example.com" | ||
| 550 | ); | ||
| 542 | } | 551 | } |
| 543 | 552 | ||
| 544 | #[test] | 553 | #[test] |
| 545 | fn test_normalize_url_without_scheme_with_port() { | 554 | fn test_normalize_url_without_scheme_with_port() { |
| 546 | let url = "relay.example.com:8080"; | 555 | let url = "relay.example.com:8080"; |
| 547 | assert_eq!(RelayConnection::normalize_url(url), "wss://relay.example.com:8080"); | 556 | assert_eq!( |
| 557 | RelayConnection::normalize_url(url), | ||
| 558 | "wss://relay.example.com:8080" | ||
| 559 | ); | ||
| 548 | } | 560 | } |
| 549 | 561 | ||
| 550 | #[test] | 562 | #[test] |
| 551 | fn test_normalize_url_with_path() { | 563 | fn test_normalize_url_with_path() { |
| 552 | let url = "relay.example.com/nostr"; | 564 | let url = "relay.example.com/nostr"; |
| 553 | assert_eq!(RelayConnection::normalize_url(url), "wss://relay.example.com/nostr"); | 565 | assert_eq!( |
| 566 | RelayConnection::normalize_url(url), | ||
| 567 | "wss://relay.example.com/nostr" | ||
| 568 | ); | ||
| 554 | } | 569 | } |
| 555 | 570 | ||
| 556 | #[test] | 571 | #[test] |
| @@ -587,6 +602,9 @@ mod tests { | |||
| 587 | fn test_normalize_url_real_world_example() { | 602 | fn test_normalize_url_real_world_example() { |
| 588 | // Test the exact case from the bug report | 603 | // Test the exact case from the bug report |
| 589 | let url = "git.shakespeare.diy"; | 604 | let url = "git.shakespeare.diy"; |
| 590 | assert_eq!(RelayConnection::normalize_url(url), "wss://git.shakespeare.diy"); | 605 | assert_eq!( |
| 606 | RelayConnection::normalize_url(url), | ||
| 607 | "wss://git.shakespeare.diy" | ||
| 608 | ); | ||
| 591 | } | 609 | } |
| 592 | } | 610 | } |