Skip to content

Commit

Permalink
Reworked function args for #317 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTschudi committed Sep 12, 2018
1 parent be078d4 commit 49f0902
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions packages/arcgis-rest-feature-service-admin/src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export interface IAddToServiceDefinitionFailureResult {
*
* @param url - URL of feature service
* @param requestOptions - Options for the request
* @returns A Promise that resolves with service details once the service has been created
* @returns A Promise that resolves with service layer and/or table details once the definition
* has been updated
*/
export function addToServiceDefinition(
url: string,
Expand All @@ -75,14 +76,14 @@ export function addToServiceDefinition(
requestOptions.params.addToDefinition.tables = requestOptions.tables;
}

return new Promise(resolve => {
return new Promise((resolve, reject) => {
request(adminUrl, requestOptions).then(
response => {
resolve(response);
},
response => {
// We're not interested in the full ArcGISRequestError response, nor having an exception thrown
resolve(response.response);
// We're not interested in the full ArcGISRequestError response
reject(response.response);
}
);
});
Expand Down
18 changes: 9 additions & 9 deletions packages/arcgis-rest-feature-service-admin/test/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ describe("add to feature service", () => {
}
)
.then(
e => {
fail(e); // call is supposed to fail
},
response => {
// Check service call
expect(fetchMock.called()).toEqual(true);
Expand All @@ -267,9 +270,6 @@ describe("add to feature service", () => {
expect(response).toEqual(AddToFeatureServiceFailResponse);

done();
},
e => {
fail(e); // call is supposed to succeed
}
)
.catch(e => {
Expand All @@ -288,6 +288,9 @@ describe("add to feature service", () => {
}
)
.then(
e => {
fail(e); // call is supposed to fail
},
response => {
// Check service call
expect(fetchMock.called()).toEqual(true);
Expand All @@ -312,9 +315,6 @@ describe("add to feature service", () => {
expect(response).toEqual(AddToFeatureServiceFailResponse);

done();
},
e => {
fail(e); // call is supposed to succeed
}
)
.catch(e => {
Expand All @@ -334,6 +334,9 @@ describe("add to feature service", () => {
}
)
.then(
e => {
fail(e); // call is supposed to fail
},
response => {
// Check service call
expect(fetchMock.called()).toEqual(true);
Expand Down Expand Up @@ -361,9 +364,6 @@ describe("add to feature service", () => {
expect(response).toEqual(AddToFeatureServiceFailResponse);

done();
},
e => {
fail(e); // call is supposed to succeed
}
)
.catch(e => {
Expand Down

0 comments on commit 49f0902

Please sign in to comment.