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

Function test_fetch_text

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

Source from the content-addressed store, hash-verified

21};
22
23export var test_fetch_text = function (done: (err: Error, res?: string) => void) {
24 // >> fetch-string
25 fetch('https://http-echo.nativescript.org/get')
26 .then((response) => response.text())
27 .then(function (r) {
28 // Argument (r) is string!
29 // >> (hide)
30 TKUnit.assert(types.isString(r), 'Result from text() should be string! Actual result is: ' + r);
31 done(null);
32 // << (hide)
33 })
34 .catch(failOnError(done));
35 // << fetch-string
36};
37
38export var test_fetch_json = function (done: (err: Error, res?: string) => void) {
39 // >> fetch-json

Callers

nothing calls this directly

Calls 4

fetchFunction · 0.85
failOnErrorFunction · 0.85
assertMethod · 0.80
textMethod · 0.45

Tested by

no test coverage detected