MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / test_fetch

Function test_fetch

apps/automated/src/fetch/fetch-tests.ts:9–21  ·  view source on GitHub ↗
(done: (err: Error, res?: string) => void)

Source from the content-addressed store, hash-verified

7};
8
9export var test_fetch = function (done: (err: Error, res?: string) => void) {
10 // >> fetch-response
11 fetch('https://http-echo.nativescript.org/get')
12 .then(function (r) {
13 // Argument (r) is Response!
14 // >> (hide)
15 TKUnit.assert(r instanceof Response, 'Result from fetch() should be valid Response object! Actual result is: ' + r);
16 done(null);
17 // << (hide)
18 })
19 .catch(failOnError(done));
20 // << fetch-response
21};
22
23export var test_fetch_text = function (done: (err: Error, res?: string) => void) {
24 // >> fetch-string

Callers

nothing calls this directly

Calls 3

fetchFunction · 0.85
failOnErrorFunction · 0.85
assertMethod · 0.80

Tested by

no test coverage detected