Skip to content

Commit 7c81290

Browse files
authored
Live query CLP (#4387)
* 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
1 parent 17bd5c3 commit 7c81290

12 files changed

+830
-238
lines changed

spec/Auth.spec.js

+29
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,33 @@ describe('Auth', () => {
120120
expect(userAuth.user instanceof Parse.User).toBe(true);
121121
expect(userAuth.user.id).toBe(user.id);
122122
});
123+
124+
it('should load auth without a config', async () => {
125+
const user = new Parse.User();
126+
await user.signUp({
127+
username: 'hello',
128+
password: 'password',
129+
});
130+
expect(user.getSessionToken()).not.toBeUndefined();
131+
const userAuth = await getAuthForSessionToken({
132+
sessionToken: user.getSessionToken(),
133+
});
134+
expect(userAuth.user instanceof Parse.User).toBe(true);
135+
expect(userAuth.user.id).toBe(user.id);
136+
});
137+
138+
it('should load auth with a config', async () => {
139+
const user = new Parse.User();
140+
await user.signUp({
141+
username: 'hello',
142+
password: 'password',
143+
});
144+
expect(user.getSessionToken()).not.toBeUndefined();
145+
const userAuth = await getAuthForSessionToken({
146+
sessionToken: user.getSessionToken(),
147+
config: Config.get('test'),
148+
});
149+
expect(userAuth.user instanceof Parse.User).toBe(true);
150+
expect(userAuth.user.id).toBe(user.id);
151+
});
123152
});

spec/CloudCode.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ describe('Cloud Code', () => {
933933
expect(response.data.result).toEqual('second data');
934934
done();
935935
})
936-
.catch(e => done.fail(e));
936+
.catch(done.fail);
937937
});
938938

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

0 commit comments

Comments
 (0)