Mercurial > hg > nginx-tests
comparison js_promise.t @ 1614:bc0990ea2e5b
Tests: js TODO adjusted up to 0.4.0.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Tue, 17 Nov 2020 17:49:16 +0000 |
parents | 5e2b8621aa5d |
children | 54f867e69cb5 |
comparison
equal
deleted
inserted
replaced
1613:d7ec131d305a | 1614:bc0990ea2e5b |
---|---|
52 js_content timeout; | 52 js_content timeout; |
53 } | 53 } |
54 | 54 |
55 location /sub_token { | 55 location /sub_token { |
56 js_content sub_token; | 56 js_content sub_token; |
57 } | |
58 | |
59 location /njs { | |
60 js_content test_njs; | |
61 } | 57 } |
62 } | 58 } |
63 } | 59 } |
64 | 60 |
65 EOF | 61 EOF |
162 var token = r.variables.arg_token; | 158 var token = r.variables.arg_token; |
163 | 159 |
164 r.return(parseInt(code), '{"token": "'+ token +'"}'); | 160 r.return(parseInt(code), '{"token": "'+ token +'"}'); |
165 } | 161 } |
166 | 162 |
167 function test_njs(r) { | |
168 r.return(200, njs.version); | |
169 } | |
170 | |
171 EOF | 163 EOF |
172 | 164 |
173 $t->try_run('no njs available')->plan(3); | 165 $t->try_run('no njs available')->plan(3); |
174 | 166 |
175 ############################################################################### | 167 ############################################################################### |
176 | 168 |
177 TODO: { | |
178 local $TODO = 'not yet' | |
179 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.3.8'; | |
180 | |
181 like(http_get('/promise'), qr/{"token": "b"}/, "Promise"); | 169 like(http_get('/promise'), qr/{"token": "b"}/, "Promise"); |
182 like(http_get('/promise_throw'), qr/{"token": "x"}/, "Promise throw and catch"); | 170 like(http_get('/promise_throw'), qr/{"token": "x"}/, "Promise throw and catch"); |
183 like(http_get('/timeout'), qr/{"token": "R"}/, "Promise with timeout"); | 171 like(http_get('/timeout'), qr/{"token": "R"}/, "Promise with timeout"); |
184 | 172 |
185 } | |
186 | |
187 ############################################################################### | 173 ############################################################################### |