Mercurial > hg > nginx-tests
comparison js_promise.t @ 1540:5e2b8621aa5d
Tests: TODO js_promise.t on njs < 0.3.8.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 27 Dec 2019 13:15:37 +0300 |
parents | beb549bce15f |
children | bc0990ea2e5b |
comparison
equal
deleted
inserted
replaced
1539:57a92c20f974 | 1540:5e2b8621aa5d |
---|---|
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; | |
57 } | 61 } |
58 } | 62 } |
59 } | 63 } |
60 | 64 |
61 EOF | 65 EOF |
158 var token = r.variables.arg_token; | 162 var token = r.variables.arg_token; |
159 | 163 |
160 r.return(parseInt(code), '{"token": "'+ token +'"}'); | 164 r.return(parseInt(code), '{"token": "'+ token +'"}'); |
161 } | 165 } |
162 | 166 |
167 function test_njs(r) { | |
168 r.return(200, njs.version); | |
169 } | |
170 | |
163 EOF | 171 EOF |
164 | 172 |
165 $t->try_run('no njs available')->plan(3); | 173 $t->try_run('no njs available')->plan(3); |
166 | 174 |
167 ############################################################################### | 175 ############################################################################### |
168 | 176 |
177 TODO: { | |
178 local $TODO = 'not yet' | |
179 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.3.8'; | |
180 | |
169 like(http_get('/promise'), qr/{"token": "b"}/, "Promise"); | 181 like(http_get('/promise'), qr/{"token": "b"}/, "Promise"); |
170 like(http_get('/promise_throw'), qr/{"token": "x"}/, "Promise throw and catch"); | 182 like(http_get('/promise_throw'), qr/{"token": "x"}/, "Promise throw and catch"); |
171 like(http_get('/timeout'), qr/{"token": "R"}/, "Promise with timeout"); | 183 like(http_get('/timeout'), qr/{"token": "R"}/, "Promise with timeout"); |
172 | 184 |
185 } | |
186 | |
173 ############################################################################### | 187 ############################################################################### |