Strip objectId out of responses from HooksController (#1925)

This commit is contained in:
Tyler Brock
2016-05-26 15:33:37 -07:00
parent dd1d18dbe6
commit c5e3be8b64
2 changed files with 10 additions and 1 deletions

View File

@@ -46,10 +46,12 @@ describe('Hooks', () => {
// Find
return Parse.Hooks.getFunction("My-Test-Function")
}).then(response => {
expect(response.objectId).toBeUndefined();
expect(response.url).toBe("http://someurl");
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
})
.then((res) => {
expect(res.objectId).toBeUndefined();
expect(res.functionName).toBe("My-Test-Function");
expect(res.url).toBe("http://anotherurl")
// delete
@@ -90,6 +92,7 @@ describe('Hooks', () => {
}).then((res) => {
expect(res).not.toBe(null);
expect(res).not.toBe(undefined);
expect(res.objectId).toBeUndefined();
expect(res.url).toBe("http://someurl");
// delete
return Parse.Hooks.updateTrigger("MyClass","beforeDelete", "http://anotherurl");
@@ -99,6 +102,7 @@ describe('Hooks', () => {
}).then((res) => {
expect(res.className).toBe("MyClass");
expect(res.url).toBe("http://anotherurl")
expect(res.objectId).toBeUndefined();
return Parse.Hooks.deleteTrigger("MyClass","beforeDelete");
}, (err) => {

View File

@@ -57,7 +57,12 @@ export class HooksController {
_getHooks(query = {}, limit) {
let options = limit ? { limit: limit } : undefined;
return this.database.find(DefaultHooksCollectionName, query);
return this.database.find(DefaultHooksCollectionName, query).then((results) => {
return results.map((result) => {
delete result.objectId;
return result;
});
});
}
_removeHooks(query) {