Skip to content

Commit

Permalink
Live query CLP (#4387)
Browse files Browse the repository at this point in the history
* Auth module refactoring in order to be reusable

* Ensure cache controller is properly forwarded from helpers

* Nits

* Adds support for static validation

* Adds support for CLP in Live query (no support for roles yet)

* Adds e2e test to validate liveQuery hooks is properly called

* Adds tests over LiveQueryController to ensure data is correctly transmitted

* nits

* Fixes for flow types

* Removes usage of Parse.Promise

* Use the Auth module for authentication and caches

* Cleaner implementation of getting auth

* Adds authCache that stores auth promises

* Proper testing of the caching

* nits
  • Loading branch information
flovilmart committed Oct 17, 2018
1 parent 17bd5c3 commit 7c81290
Show file tree
Hide file tree
Showing 12 changed files with 830 additions and 238 deletions.
29 changes: 29 additions & 0 deletions spec/Auth.spec.js
Expand Up @@ -120,4 +120,33 @@ describe('Auth', () => {
expect(userAuth.user instanceof Parse.User).toBe(true);
expect(userAuth.user.id).toBe(user.id);
});

it('should load auth without a config', async () => {
const user = new Parse.User();
await user.signUp({
username: 'hello',
password: 'password',
});
expect(user.getSessionToken()).not.toBeUndefined();
const userAuth = await getAuthForSessionToken({
sessionToken: user.getSessionToken(),
});
expect(userAuth.user instanceof Parse.User).toBe(true);
expect(userAuth.user.id).toBe(user.id);
});

it('should load auth with a config', async () => {
const user = new Parse.User();
await user.signUp({
username: 'hello',
password: 'password',
});
expect(user.getSessionToken()).not.toBeUndefined();
const userAuth = await getAuthForSessionToken({
sessionToken: user.getSessionToken(),
config: Config.get('test'),
});
expect(userAuth.user instanceof Parse.User).toBe(true);
expect(userAuth.user.id).toBe(user.id);
});
});
2 changes: 1 addition & 1 deletion spec/CloudCode.spec.js
Expand Up @@ -933,7 +933,7 @@ describe('Cloud Code', () => {
expect(response.data.result).toEqual('second data');
done();
})
.catch(e => done.fail(e));
.catch(done.fail);
});

it('trivial beforeSave should not affect fetched pointers (regression test for #1238)', done => {
Expand Down

0 comments on commit 7c81290

Please sign in to comment.