comparison js_modules.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
comparison
equal deleted inserted replaced
1750:b28f88e352dd 1751:18ac4d9e5a2a
33 } 33 }
34 34
35 http { 35 http {
36 %%TEST_GLOBALS_HTTP%% 36 %%TEST_GLOBALS_HTTP%%
37 37
38 js_include test.js; 38 js_import test.js;
39 39
40 server { 40 server {
41 listen 127.0.0.1:8080; 41 listen 127.0.0.1:8080;
42 server_name localhost; 42 server_name localhost;
43 43
44 location /test { 44 location /test {
45 js_content test; 45 js_content test.test;
46 } 46 }
47 } 47 }
48 } 48 }
49 49
50 EOF 50 EOF
53 import m from 'module.js'; 53 import m from 'module.js';
54 54
55 function test(r) { 55 function test(r) {
56 r.return(200, m[r.args.fun](r.args.a, r.args.b)); 56 r.return(200, m[r.args.fun](r.args.a, r.args.b));
57 } 57 }
58
59 export default {test};
58 60
59 EOF 61 EOF
60 62
61 $t->write_file('module.js', <<EOF); 63 $t->write_file('module.js', <<EOF);
62 function sum(a, b) { 64 function sum(a, b) {