@@ -95,15 +95,20 @@ def test_injects_toolbar_into_html_responses
9595 assert_equal "demo-app" , payload . dig ( "tidewave" , "project_name" )
9696 assert_equal 5000 , payload . dig ( "tidewave" , "local_port" )
9797 assert_equal @tmpdir , payload [ "root" ]
98+ assert_equal ( { } , payload [ "framework" ] )
9899 end
99100
100- def test_config_includes_the_wsl_distribution
101+ def test_toolbar_config_includes_the_wsl_distribution_at_the_top_level
101102 previous_wsl_distro = ENV [ "WSL_DISTRO_NAME" ]
102103 ENV [ "WSL_DISTRO_NAME" ] = "Ubuntu-24.04"
103- app = Tidewave . new ( @downstream_app , allow_remote_access : true , project_name : "demo-app" )
104+ downstream = -> ( _env ) { [ 200 , { "content-type" => "text/html" } , [ "<head></head>" ] ] }
105+ app = Tidewave . new ( downstream , allow_remote_access : true , project_name : "demo-app" )
104106
105- _status , _headers , body = perform_request ( app , path : "/tidewave/config" )
106- assert_equal "Ubuntu-24.04" , JSON . parse ( body ) [ "wsl_distro" ]
107+ _status , _headers , body = perform_request ( app , path : "/" )
108+ payload = JSON . parse ( CGI . unescapeHTML ( body [ /name="tidewave:config" content="([^"]+)"/ , 1 ] ) )
109+
110+ assert_equal "Ubuntu-24.04" , payload [ "wsl_distro" ]
111+ refute payload [ "tidewave" ] . key? ( "wsl_distro" )
107112 ensure
108113 ENV [ "WSL_DISTRO_NAME" ] = previous_wsl_distro
109114 end
0 commit comments