Skip to content

Commit 5cc8051

Browse files
authored
Merge pull request NativeScript#2390 from NativeScript/jasssonpet/fetch-tests
Remove unused result variables in fetch tests
2 parents e61affc + 6504559 commit 5cc8051

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

tests/app/fetch-tests.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ export var test_fetch_defined = function () {
77
};
88

99
export var test_fetch = function (done: (err: Error, res?: string) => void) {
10-
var result;
1110
// >> fetch-response
1211
fetch("https://httpbin.org/get").then(function (r) {
1312
// Argument (r) is Response!
1413
// >> (hide)
15-
TKUnit.assert(r instanceof Response, "Result from fetch() should be valid Response object! Actual result is: " + result);
14+
TKUnit.assert(r instanceof Response, "Result from fetch() should be valid Response object! Actual result is: " + r);
1615
done(null);
1716
// << (hide)
1817
}, function (e) {
@@ -25,8 +24,6 @@ export var test_fetch = function (done: (err: Error, res?: string) => void) {
2524
};
2625

2726
export var test_fetch_text = function (done: (err: Error, res?: string) => void) {
28-
var result;
29-
3027
// >> fetch-string'
3128
fetch("https://httpbin.org/get").then(response => { return response.text(); }).then(function (r) {
3229
// Argument (r) is string!
@@ -44,8 +41,6 @@ export var test_fetch_text = function (done: (err: Error, res?: string) => void)
4441
};
4542

4643
export var test_fetch_json = function (done: (err: Error, res?: string) => void) {
47-
var result;
48-
4944
// >> fetch-json
5045
fetch("https://httpbin.org/get").then(response => { return response.json(); }).then(function (r) {
5146
// Argument (r) is JSON object!
@@ -63,8 +58,6 @@ export var test_fetch_json = function (done: (err: Error, res?: string) => void)
6358
};
6459

6560
export var test_fetch_formData = function (done: (err: Error, res?: string) => void) {
66-
var result;
67-
6861
// >> fetch-formdata
6962
fetch("https://httpbin.org/get").then(response => { return response.formData(); }).then(function (r) {
7063
// Argument (r) is FormData object!
@@ -140,13 +133,11 @@ export var test_fetch_response_headers = function (done) {
140133
};
141134

142135
export var test_fetch_headers_sent = function (done) {
143-
var result: Headers;
144-
145136
fetch("https://httpbin.org/get", {
146137
method: "GET",
147138
headers: { "Content-Type": "application/json" }
148139
}).then(function (response) {
149-
result = response.headers;
140+
var result = response.headers;
150141
try {
151142
TKUnit.assert(result.get("Content-Type") === "application/json", "Headers not sent/received properly! Actual result is: " + result);
152143
done(null);

0 commit comments

Comments
 (0)