Skip to content

Commit

Permalink
test: ensure stream response is of type Readable
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerjt committed Feb 14, 2019
1 parent 893e647 commit 5f517bd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/arcgis-rest-request/test/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ describe("request()", () => {
});
});

it("should return a stream if defined", done => {
fetchMock.once("*", GeoJSONFeatureCollection);

request(
"https://services1.arcgis.com/ORG/arcgis/rest/services/FEATURE_SERVICE/FeatureServer/0/query",
{
httpMethod: "GET",
params: { where: "1=1", f: "geojson" },
stream: true
}
)
.then(response => {
expect(/Readable/.test(response.constructor.name)).toBe(true);
done();
})
.catch(e => {
fail(e);
});
});

describe("should throw errors when required dependencies are missing", () => {
const oldPromise = Promise;
const oldFetch = fetch;
Expand Down

0 comments on commit 5f517bd

Please sign in to comment.