Skip to content

Fix sign up user in cloud function #7351

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

Open
wants to merge 4 commits into
base: alpha
Choose a base branch
from
Open
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
44 changes: 44 additions & 0 deletions spec/Auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,48 @@ describe('Auth', () => {
expect(cloudRoles2.length).toBe(rolesNumber);
});
});

fit('succes to login when masterkey and instalationId is provided and when password is not provided', async () => {
const user = new Parse.User();
const savedUser = await user.save({
username: 'yolo',
password: 'yolopass',
email: 'yo@lo.com',
});
const installationId = '123456789';
const query = new Parse.Query(Parse.User);
const result = await query.get(savedUser.id, {
useMasterKey: true,
installationId: installationId,
});

try {
await result.logIn({ useMasterKey: true, installationId: installationId });
} catch (error) {
fail(error.message);
}
});

fit('succes to get session token when masterkey and instalationId is provided', async () => {
const user = new Parse.User();
user.set('username', 'yolo');
user.set('password', 'yolopass');
user.set('email', 'yo@lo.com');
const savedUser = await user.signUp();

const installationId = '123456789';
const querySession = new Parse.Query(Parse.Session);
const session = await querySession.first();

expect(session).not.toBeUndefined();

const userQuery = new Parse.Query(Parse.User);
const result = await userQuery.get(savedUser.id, {
useMasterKey: true,
installationId: installationId,
});

const userSession = result.getSessionToken();
expect(userSession).toEqual(session);
});
});