Mercurial > hg > nginx-tests
diff stream_js_variables.t @ 1751:18ac4d9e5a2a
Tests: rewriting njs tests without deprecated "js_include".
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Thu, 09 Dec 2021 17:36:29 +0000 |
parents | bc0990ea2e5b |
children |
line wrap: on
line diff
--- a/stream_js_variables.t +++ b/stream_js_variables.t @@ -36,10 +36,10 @@ events { stream { %%TEST_GLOBALS_STREAM%% - js_set $test_var test_var; - js_set $test_not_found test_not_found; + js_set $test_var test.variable; + js_set $test_not_found test.not_found; - js_include test.js; + js_import test.js; server { listen 127.0.0.1:8081; @@ -55,12 +55,12 @@ stream { EOF $t->write_file('test.js', <<EOF); - function test_var(s) { + function variable(s) { s.variables.status = 400; return 'test_var'; } - function test_not_found(s) { + function not_found(s) { try { s.variables.unknown = 1; } catch (e) { @@ -68,6 +68,8 @@ EOF } } + export default {variable, not_found}; + EOF $t->try_run('no stream njs available')->plan(2);