Skip to content

Cleanup update #1590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/ParseACL.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ describe('Parse.ACL', () => {
ok(object.get("ACL"));

// Start making requests by the public, which should all fail.
Parse.User.logOut();

// Delete
object.destroy().then(() => {
Parse.User.logOut()
.then(() => object.destroy())
.then(() => {
fail('destroy should fail');
done();
}, error => {
expect(error.code).toEqual(Parse.Error.OBJECT_NOT_FOUND);
done();
Expand Down
2 changes: 1 addition & 1 deletion spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('miscellaneous', function() {
expect(data.get('password')).toBeUndefined();
done();
}, function(err) {
console.log(err);
fail(err);
done();
});
});

Expand Down
82 changes: 38 additions & 44 deletions spec/ParseHooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,44 @@ describe('Hooks', () => {
});
});

it("should CRUD a function registration", (done) => {
// Create
Parse.Hooks.createFunction("My-Test-Function", "http://someurl").then((res) => {
expect(res.functionName).toBe("My-Test-Function");
expect(res.url).toBe("http://someurl")
// Find
return Parse.Hooks.getFunction("My-Test-Function");
}, (err) => {
fail(err);
done();
}).then((res) => {
expect(res).not.toBe(null);
expect(res).not.toBe(undefined);
expect(res.url).toBe("http://someurl");
// delete
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
}, (err) => {
fail(err);
done();
}).then((res) => {
expect(res.functionName).toBe("My-Test-Function");
expect(res.url).toBe("http://anotherurl")

return Parse.Hooks.deleteFunction("My-Test-Function");
}, (err) => {
fail(err);
done();
}).then((res) => {
// Find again! but should be deleted
return Parse.Hooks.getFunction("My-Test-Function");
}, (err) => {
fail(err);
done();
}).then((res) => {
fail("Should not succeed")
done();
}, (err) => {
expect(err).not.toBe(null);
expect(err).not.toBe(undefined);
expect(err.code).toBe(143);
expect(err.error).toBe("no function named: My-Test-Function is defined")
done();
})
});
it("should CRUD a function registration", (done) => {
// Create
Parse.Hooks.createFunction("My-Test-Function", "http://someurl")
.then(response => {
expect(response.functionName).toBe("My-Test-Function");
expect(response.url).toBe("http://someurl")
// Find
return Parse.Hooks.getFunction("My-Test-Function")
}).then(response => {
expect(response.url).toBe("http://someurl");
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
})
.then((res) => {
expect(res.functionName).toBe("My-Test-Function");
expect(res.url).toBe("http://anotherurl")
// delete
return Parse.Hooks.deleteFunction("My-Test-Function")
})
.then((res) => {
// Find again! but should be deleted
return Parse.Hooks.getFunction("My-Test-Function")
.then(res => {
fail("Failed to delete hook")
fail(res)
done();
return Promise.resolve();
}, (err) => {
expect(err.code).toBe(143);
expect(err.error).toBe("no function named: My-Test-Function is defined")
done();
return Promise.resolve();
})
})
.catch(error => {
fail(error);
done();
})
});

it("should CRUD a trigger registration", (done) => {
// Create
Expand Down
56 changes: 28 additions & 28 deletions spec/PointerPermissions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('Pointer Permissions', () => {
done();
});
});


it('should work with write', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should let a proper user find', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Pointer Permissions', () => {
let q = new Parse.Query('AnObject');
return q.find();
}).then((res) => {
expect(res.length).toBe(0);
expect(res.length).toBe(0);
}).then(() => {
return Parse.User.logIn('user2', 'password');
}).then(() => {
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should not allow creating objects', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand All @@ -193,7 +193,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should handle multiple writeUserFields', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should prevent creating pointer permission on missing field', (done) => {
let config = new Config(Parse.applicationId);
config.database.loadSchema().then((schema) => {
Expand All @@ -248,7 +248,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should prevent creating pointer permission on bad field', (done) => {
let config = new Config(Parse.applicationId);
config.database.loadSchema().then((schema) => {
Expand All @@ -261,7 +261,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should prevent creating pointer permission on bad field', (done) => {
let config = new Config(Parse.applicationId);
let object = new Parse.Object('AnObject');
Expand All @@ -278,14 +278,14 @@ describe('Pointer Permissions', () => {
done();
})
});

it('tests CLP / Pointer Perms / ACL write (PP Locked)', (done) => {
/*
tests:
CLP: update open ({"*": true})
PointerPerm: "owner"
ACL: logged in user has access

The owner is another user than the ACL
*/
let config = new Config(Parse.applicationId);
Expand Down Expand Up @@ -325,7 +325,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('tests CLP / Pointer Perms / ACL write (ACL Locked)', (done) => {
/*
tests:
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('tests CLP / Pointer Perms / ACL write (ACL/PP OK)', (done) => {
/*
tests:
Expand Down Expand Up @@ -415,7 +415,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('tests CLP / Pointer Perms / ACL read (PP locked)', (done) => {
/*
tests:
Expand Down Expand Up @@ -462,7 +462,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('tests CLP / Pointer Perms / ACL read (PP/ACL OK)', (done) => {
/*
tests:
Expand Down Expand Up @@ -509,7 +509,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('tests CLP / Pointer Perms / ACL read (ACL locked)', (done) => {
/*
tests:
Expand Down Expand Up @@ -554,7 +554,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('should let master key find objects', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand All @@ -569,7 +569,7 @@ describe('Pointer Permissions', () => {
let q = new Parse.Query('AnObject');
return q.find();
}).then(() => {

}, (err) => {
expect(err.code).toBe(101);
return Promise.resolve();
Expand All @@ -584,7 +584,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should let master key get objects', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand All @@ -599,7 +599,7 @@ describe('Pointer Permissions', () => {
let q = new Parse.Query('AnObject');
return q.get(object.id);
}).then(() => {

}, (err) => {
expect(err.code).toBe(101);
return Promise.resolve();
Expand All @@ -615,8 +615,8 @@ describe('Pointer Permissions', () => {
done();
})
});


it('should let master key update objects', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand All @@ -630,7 +630,7 @@ describe('Pointer Permissions', () => {
}).then(() => {
return object.save({'hello': 'bar'});
}).then(() => {

}, (err) => {
expect(err.code).toBe(101);
return Promise.resolve();
Expand All @@ -644,7 +644,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should let master key delete objects', (done) => {
let config = new Config(Parse.applicationId);
let user = new Parse.User();
Expand All @@ -658,7 +658,7 @@ describe('Pointer Permissions', () => {
}).then(() => {
return object.destroy();
}).then(() => {

fail();
}, (err) => {
expect(err.code).toBe(101);
return Promise.resolve();
Expand All @@ -671,7 +671,7 @@ describe('Pointer Permissions', () => {
done();
})
});

it('should fail with invalid pointer perms', () => {
let config = new Config(Parse.applicationId);
config.database.loadSchema().then((schema) => {
Expand All @@ -682,7 +682,7 @@ describe('Pointer Permissions', () => {
done();
});
});

it('should fail with invalid pointer perms', () => {
let config = new Config(Parse.applicationId);
config.database.loadSchema().then((schema) => {
Expand All @@ -693,5 +693,5 @@ describe('Pointer Permissions', () => {
done();
});
})

});
Loading