(done: (err: Error, res?: string) => void)
| 36 | }; |
| 37 | |
| 38 | export var test_fetch_json = function (done: (err: Error, res?: string) => void) { |
| 39 | // >> fetch-json |
| 40 | fetch('https://http-echo.nativescript.org/get') |
| 41 | .then((response) => response.json()) |
| 42 | .then(function (r) { |
| 43 | // Argument (r) is JSON object! |
| 44 | // >> (hide) |
| 45 | TKUnit.assertNotNull(r, 'Result from json() should be JSON object!'); |
| 46 | done(null); |
| 47 | // << (hide) |
| 48 | }) |
| 49 | .catch(failOnError(done)); |
| 50 | // << fetch-json |
| 51 | }; |
| 52 | |
| 53 | export var test_fetch_formData = function (done: (err: Error, res?: string) => void) { |
| 54 | // >> fetch-formdata |
nothing calls this directly
no test coverage detected