diff 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/js_variables.t
+++ b/js_variables.t
@@ -35,26 +35,26 @@ events {
 http {
     %%TEST_GLOBALS_HTTP%%
 
-    js_set $test_var   test_var;
+    js_set $test_var   test.variable;
 
-    js_include test.js;
+    js_import test.js;
 
     server {
         listen       127.0.0.1:8080;
         server_name  localhost;
 
-        set $foo       foo_orig;
+        set $foo       test.foo_orig;
 
         location /var_set {
             return 200 $test_var$foo;
         }
 
         location /content_set {
-            js_content content_set;
+            js_content test.content_set;
         }
 
         location /not_found_set {
-            js_content not_found_set;
+            js_content test.not_found_set;
         }
     }
 }
@@ -62,7 +62,7 @@ http {
 EOF
 
 $t->write_file('test.js', <<EOF);
-    function test_var(r) {
+    function variable(r) {
         r.variables.foo = r.variables.arg_a;
         return 'test_var';
     }
@@ -80,6 +80,8 @@ EOF
         }
     }
 
+    export default {variable, content_set, not_found_set};
+
 EOF
 
 $t->try_run('no njs')->plan(3);