@@ -142,6 +142,7 @@ pub mod tests {
142142 impl NostrContactStoreApi for NostrContactStore {
143143 async fn by_node_id( & self , node_id: & NodeId ) -> Result <Option <NostrContact >>;
144144 async fn by_node_ids( & self , node_ids: Vec <NodeId >) -> Result <Vec <NostrContact >>;
145+ async fn get_all( & self ) -> Result <Vec <NostrContact >>;
145146 async fn by_npub( & self , npub: & NostrPublicKey ) -> Result <Option <NostrContact >>;
146147 async fn upsert( & self , data: & NostrContact ) -> Result <( ) >;
147148 async fn delete( & self , node_id: & NodeId ) -> Result <( ) >;
@@ -492,6 +493,7 @@ pub mod tests {
492493 nostr_config : NostrConfig {
493494 only_known_contacts : false ,
494495 relays : vec ! [ url:: Url :: parse( "ws://localhost:8080" ) . unwrap( ) ] ,
496+ max_relays : Some ( 50 ) ,
495497 } ,
496498 mint_config : MintConfig {
497499 default_mint_url : url:: Url :: parse ( "http://localhost:4242/" ) . unwrap ( ) ,
@@ -681,4 +683,35 @@ pub mod tests {
681683 pub fn test_ts ( ) -> Timestamp {
682684 Timestamp :: new ( 1731593928 ) . unwrap ( )
683685 }
686+
687+ #[ cfg( test) ]
688+ mod config_tests {
689+ use crate :: NostrConfig ;
690+
691+ #[ test]
692+ fn test_nostr_config_default_max_relays ( ) {
693+ let config = NostrConfig :: default ( ) ;
694+ assert_eq ! ( config. max_relays, Some ( 50 ) ) ;
695+ }
696+
697+ #[ test]
698+ fn test_nostr_config_with_custom_max_relays ( ) {
699+ let config = NostrConfig {
700+ only_known_contacts : true ,
701+ relays : vec ! [ ] ,
702+ max_relays : Some ( 100 ) ,
703+ } ;
704+ assert_eq ! ( config. max_relays, Some ( 100 ) ) ;
705+ }
706+
707+ #[ test]
708+ fn test_nostr_config_with_no_relay_limit ( ) {
709+ let config = NostrConfig {
710+ only_known_contacts : false ,
711+ relays : vec ! [ ] ,
712+ max_relays : None ,
713+ } ;
714+ assert_eq ! ( config. max_relays, None ) ;
715+ }
716+ }
684717}
0 commit comments