Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed May 10, 2018
1 parent afb9e38 commit fd56e6f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/arcgis-rest-items/test/items.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,34 @@ describe("search", () => {
});
});

it("should pass through other requestOptions at the same time", done => {
fetchMock.once("*", SearchResponse);

searchItems({
searchForm: {
q: "DC AND typekeywords:hubSiteApplication",
num: 12,
start: 22,
sortField: "title",
sortDir: "desc"
},
httpMethod: "POST"
})
.then(response => {
expect(fetchMock.called()).toEqual(true);
const [url, options]: [string, RequestInit] = fetchMock.lastCall("*");
expect(url).toEqual("https://www.arcgis.com/sharing/rest/search");
expect(options.body).toContain(
"q=DC%20AND%20typekeywords%3AhubSiteApplication&num=12&start=22&sortField=title&sortDir=desc"
);
expect(options.method).toBe("POST");
done();
})
.catch(e => {
fail(e);
});
});

it("should return an item by id", done => {
fetchMock.once("*", ItemResponse);

Expand Down

0 comments on commit fd56e6f

Please sign in to comment.