-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
43 deletions.
There are no files selected for viewing
86 changes: 43 additions & 43 deletions
86
definitions/npm/isomorphic-unfetch_v3.x.x/test_isomorphic-unfetch_v3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
import isoUnfetch from "isomorphic-unfetch"; | ||
import isoUnfetch from 'isomorphic-unfetch'; | ||
|
||
(isoUnfetch("foo"): Promise<Response>); | ||
(isoUnfetch("foo", {}): Promise<Response>); | ||
(isoUnfetch('foo'): Promise<Response>); | ||
(isoUnfetch('foo', {}): Promise<Response>); | ||
|
||
// $ExpectError url has to be string | ||
(isoUnfetch(123): Promise<any>); | ||
|
||
isoUnfetch("foo", { | ||
method: "GET" | ||
isoUnfetch('foo', { | ||
method: 'GET' | ||
}); | ||
|
||
isoUnfetch("foo", { | ||
body: "bar" | ||
isoUnfetch('foo', { | ||
body: 'bar' | ||
}); | ||
|
||
// $ExpectError number is not a valid body type | ||
isoUnfetch("foo", { | ||
body: 5 | ||
isoUnfetch('foo', { | ||
body: 5 | ||
}); | ||
|
||
// Response tests | ||
isoUnfetch("foo").then(res => { | ||
(res.clone(): Response); | ||
|
||
// Response Headers | ||
(res.headers: Headers); | ||
(res.headers.append("foo", "bar"): void); | ||
// $ExpectError | ||
(res.headers.append(5, "bar"): void); | ||
(res.headers.delete("foo"): void); | ||
// $ExpectError | ||
(res.headers.delete(5): void); | ||
(res.headers.entries(): Iterator<*>); | ||
(res.headers.get("test"): string); | ||
// $ExpectError | ||
(res.headers.get(5): string); | ||
(res.headers.has("foo"): boolean); | ||
// $ExpectError | ||
(res.headers.has(5): boolean); | ||
(res.headers.keys(): Iterator<string>); | ||
// $ExpectError value should be a string | ||
(res.headers.set("foo", 5): void); | ||
(res.headers.values(): Iterator<*>); | ||
|
||
(res.ok: boolean); | ||
(res.status: number); | ||
(res.statusText: string); | ||
|
||
// Response type | ||
(res.type: ResponseType); | ||
res.type = "basic"; | ||
// $ExpectError foo is not a valid option | ||
res.type = "foo"; | ||
|
||
(res.url: string); | ||
isoUnfetch('foo').then(res => { | ||
(res.clone(): Response); | ||
|
||
// Response Headers | ||
(res.headers: Headers); | ||
(res.headers.append('foo', 'bar'): void); | ||
// $ExpectError | ||
(res.headers.append(5, 'bar'): void); | ||
(res.headers.delete('foo'): void); | ||
// $ExpectError | ||
(res.headers.delete(5): void); | ||
(res.headers.entries(): Iterator<*>); | ||
(res.headers.get('test'): string); | ||
// $ExpectError | ||
(res.headers.get(5): string); | ||
(res.headers.has('foo'): boolean); | ||
// $ExpectError | ||
(res.headers.has(5): boolean); | ||
(res.headers.keys(): Iterator<string>); | ||
// $ExpectError value should be a string | ||
(res.headers.set('foo', 5): void); | ||
(res.headers.values(): Iterator<*>); | ||
|
||
(res.ok: boolean); | ||
(res.status: number); | ||
(res.statusText: string); | ||
|
||
// Response type | ||
(res.type: ResponseType); | ||
res.type = 'basic'; | ||
// $ExpectError foo is not a valid option | ||
res.type = 'foo'; | ||
|
||
(res.url: string); | ||
}); |