Strip objectId out of responses from HooksController (#1925)
This commit is contained in:
@@ -46,10 +46,12 @@ describe('Hooks', () => {
|
|||||||
// Find
|
// Find
|
||||||
return Parse.Hooks.getFunction("My-Test-Function")
|
return Parse.Hooks.getFunction("My-Test-Function")
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
expect(response.objectId).toBeUndefined();
|
||||||
expect(response.url).toBe("http://someurl");
|
expect(response.url).toBe("http://someurl");
|
||||||
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
|
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
expect(res.objectId).toBeUndefined();
|
||||||
expect(res.functionName).toBe("My-Test-Function");
|
expect(res.functionName).toBe("My-Test-Function");
|
||||||
expect(res.url).toBe("http://anotherurl")
|
expect(res.url).toBe("http://anotherurl")
|
||||||
// delete
|
// delete
|
||||||
@@ -90,6 +92,7 @@ describe('Hooks', () => {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
expect(res).not.toBe(null);
|
expect(res).not.toBe(null);
|
||||||
expect(res).not.toBe(undefined);
|
expect(res).not.toBe(undefined);
|
||||||
|
expect(res.objectId).toBeUndefined();
|
||||||
expect(res.url).toBe("http://someurl");
|
expect(res.url).toBe("http://someurl");
|
||||||
// delete
|
// delete
|
||||||
return Parse.Hooks.updateTrigger("MyClass","beforeDelete", "http://anotherurl");
|
return Parse.Hooks.updateTrigger("MyClass","beforeDelete", "http://anotherurl");
|
||||||
@@ -99,6 +102,7 @@ describe('Hooks', () => {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
expect(res.className).toBe("MyClass");
|
expect(res.className).toBe("MyClass");
|
||||||
expect(res.url).toBe("http://anotherurl")
|
expect(res.url).toBe("http://anotherurl")
|
||||||
|
expect(res.objectId).toBeUndefined();
|
||||||
|
|
||||||
return Parse.Hooks.deleteTrigger("MyClass","beforeDelete");
|
return Parse.Hooks.deleteTrigger("MyClass","beforeDelete");
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
|||||||
@@ -57,7 +57,12 @@ export class HooksController {
|
|||||||
|
|
||||||
_getHooks(query = {}, limit) {
|
_getHooks(query = {}, limit) {
|
||||||
let options = limit ? { limit: limit } : undefined;
|
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) {
|
_removeHooks(query) {
|
||||||
|
|||||||
Reference in New Issue
Block a user