@@ -629,6 +629,39 @@ async fn not_found() -> Response {
629629 ( StatusCode :: NOT_FOUND , "404" ) . into_response ( )
630630}
631631
632+ /// Constructs a minimal Axum router suitable for integration tests.
633+ pub async fn build_router_for_tests ( ) -> Router {
634+ use terraphim_config:: ConfigBuilder ;
635+
636+ // Create minimal test configuration
637+ let mut config = ConfigBuilder :: new ( )
638+ . build_default_embedded ( )
639+ . build ( )
640+ . expect ( "Failed to build test config" ) ;
641+
642+ let config_state = ConfigState :: new ( & mut config)
643+ . await
644+ . expect ( "Failed to create ConfigState" ) ;
645+
646+ let ( tx, _rx) = channel :: < IndexedDocument > ( 10 ) ;
647+
648+ // Initialize summarization manager
649+ let summarization_manager = Arc :: new ( SummarizationManager :: new ( QueueConfig :: default ( ) ) ) ;
650+
651+ // Initialize workflow management components for tests
652+ let workflow_sessions = Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ;
653+ let ( websocket_broadcaster, _) = broadcast:: channel ( 100 ) ;
654+
655+ // Create extended application state for tests
656+ let app_state = AppState {
657+ config_state,
658+ workflow_sessions,
659+ websocket_broadcaster,
660+ } ;
661+
662+ build_router ( app_state, tx, summarization_manager, false )
663+ }
664+
632665#[ cfg( test) ]
633666mod tests {
634667 use super :: * ;
@@ -860,36 +893,3 @@ mod tests {
860893 assert ! ( !desc. is_empty( ) ) ;
861894 }
862895}
863-
864- /// Constructs a minimal Axum router suitable for integration tests.
865- pub async fn build_router_for_tests ( ) -> Router {
866- use terraphim_config:: ConfigBuilder ;
867-
868- // Create minimal test configuration
869- let mut config = ConfigBuilder :: new ( )
870- . build_default_embedded ( )
871- . build ( )
872- . expect ( "Failed to build test config" ) ;
873-
874- let config_state = ConfigState :: new ( & mut config)
875- . await
876- . expect ( "Failed to create ConfigState" ) ;
877-
878- let ( tx, _rx) = channel :: < IndexedDocument > ( 10 ) ;
879-
880- // Initialize summarization manager
881- let summarization_manager = Arc :: new ( SummarizationManager :: new ( QueueConfig :: default ( ) ) ) ;
882-
883- // Initialize workflow management components for tests
884- let workflow_sessions = Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ;
885- let ( websocket_broadcaster, _) = broadcast:: channel ( 100 ) ;
886-
887- // Create extended application state for tests
888- let app_state = AppState {
889- config_state,
890- workflow_sessions,
891- websocket_broadcaster,
892- } ;
893-
894- build_router ( app_state, tx, summarization_manager, false )
895- }
0 commit comments