# HG changeset patch # User Sergey Kandaurov # Date 1528962471 -10800 # Node ID 4d5d1e59f45e2e50e05420dba302fcfc52223239 # Parent 9fbe84b7ddc61b74a7ab463d6575ad507d7eae10 Tests: TODO js_internal_redirect.t on njs < 0.2.2. On older njs versions, js runtime exception is thrown: "TypeError: cannot find property 'internalRedirect' of an external object". diff --git a/js_internal_redirect.t b/js_internal_redirect.t --- a/js_internal_redirect.t +++ b/js_internal_redirect.t @@ -43,6 +43,10 @@ http { listen 127.0.0.1:8080; server_name localhost; + location /njs { + js_content test_njs; + } + location /test { js_content test_redirect; } @@ -61,6 +65,10 @@ http { EOF $t->write_file('test.js', <try_run('no njs internalRedirect')->plan(3); +$t->try_run('no njs available')->plan(3); ############################################################################### +TODO: { +local $TODO = 'no njs internalRedirect' + unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.2'; + like(http_get('/test'), qr/redirect/s, 'redirect'); like(http_get('/test?a=A'), qr/redirectA/s, 'redirect with args'); like(http_get('/test?dest=named'), qr/named/s, 'redirect to named location'); +} + ###############################################################################