@@ -45,6 +45,10 @@ def test_find_route
4545 entry = @app . find_route ( '/test/api_1' )
4646 assert_equal :not_found , entry [ :kind ]
4747
48+ entry = @app . find_route ( '/test/about/foo' )
49+ assert_equal :markdown , entry [ :kind ]
50+ assert_equal full_path ( 'about/foo.md' ) , entry [ :fn ]
51+
4852 pp @app . route_cache
4953 end
5054
@@ -73,5 +77,32 @@ def test_app_rendering
7377
7478 req = make_request ( ':method' => 'GET' , ':path' => '/assets/style.css' )
7579 assert_equal Qeweney ::Status ::NOT_FOUND , req . response_status
80+
81+ req = make_request ( ':method' => 'GET' , ':path' => '/test/api?q=get' )
82+ assert_equal ( { status : 'OK' , response : 0 } , req . response_json )
83+
84+ req = make_request ( ':method' => 'GET' , ':path' => '/test/api/foo?q=get' )
85+ assert_equal ( { status : 'OK' , response : 0 } , req . response_json )
86+
87+ req = make_request ( ':method' => 'POST' , ':path' => '/test/api?q=incr' )
88+ assert_equal ( { status : 'OK' , response : 1 } , req . response_json )
89+
90+ req = make_request ( ':method' => 'POST' , ':path' => '/test/api/foo?q=incr' )
91+ assert_equal ( { status : 'Syntropy::Error' , message : 'Teapot' } , req . response_json )
92+ assert_equal Qeweney ::Status ::TEAPOT , req . response_status
93+
94+ req = make_request ( ':method' => 'GET' , ':path' => '/test/bar' )
95+ assert_equal 'foobar' , req . response_body
96+
97+ req = make_request ( ':method' => 'GET' , ':path' => '/test/about' )
98+ assert_equal 'About' , req . response_body . chomp
99+
100+ req = make_request ( ':method' => 'GET' , ':path' => '/test/about/foo' )
101+ assert_equal '<p>Hello from Markdown</p>' , req . response_body . chomp
102+
103+ req = make_request ( ':method' => 'GET' , ':path' => '/test/about/foo/bar' )
104+ assert_equal Qeweney ::Status ::NOT_FOUND , req . response_status
105+
106+
76107 end
77108end
0 commit comments