Skip to content

Commit 8917926

Browse files
committed
fix: merge tests
1 parent 2a6df76 commit 8917926

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

spec/CloudCode.spec.js

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4731,48 +4731,6 @@ describe('beforePasswordResetRequest hook', () => {
47314731
expect(sendPasswordResetEmailCalled).toBe(false);
47324732
});
47334733

4734-
it('should be able to block password reset request if an error is thrown even if the user has an attached file', async () => {
4735-
let hit = 0;
4736-
let sendPasswordResetEmailCalled = false;
4737-
const emailAdapter = {
4738-
sendVerificationEmail: () => Promise.resolve(),
4739-
sendPasswordResetEmail: () => {
4740-
sendPasswordResetEmailCalled = true;
4741-
},
4742-
sendMail: () => {},
4743-
};
4744-
4745-
await reconfigureServer({
4746-
appName: 'test',
4747-
emailAdapter: emailAdapter,
4748-
publicServerURL: 'http://localhost:8378/1',
4749-
});
4750-
4751-
Parse.Cloud.beforePasswordResetRequest(req => {
4752-
hit++;
4753-
throw new Error('password reset blocked');
4754-
});
4755-
4756-
const user = new Parse.User();
4757-
user.setUsername('testuser2');
4758-
user.setPassword('password');
4759-
user.set('email', '[email protected]');
4760-
await user.signUp();
4761-
const base64 = 'V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=';
4762-
const file = new Parse.File('myfile.txt', { base64 });
4763-
await file.save();
4764-
await user.save({ file });
4765-
4766-
try {
4767-
await Parse.User.requestPasswordReset('[email protected]');
4768-
throw new Error('should not have sent password reset email.');
4769-
} catch (e) {
4770-
expect(e.message).toBe('password reset blocked');
4771-
}
4772-
expect(hit).toBe(1);
4773-
expect(sendPasswordResetEmailCalled).toBe(false);
4774-
});
4775-
47764734
it('should not run beforePasswordResetRequest if email does not exist', async () => {
47774735
let hit = 0;
47784736
const emailAdapter = {
@@ -4824,6 +4782,11 @@ describe('beforePasswordResetRequest hook', () => {
48244782
user.setPassword('password');
48254783
user.set('email', '[email protected]');
48264784
await user.signUp();
4785+
const base64 = 'V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=';
4786+
const file = new Parse.File('myfile.txt', { base64 });
4787+
await file.save();
4788+
await user.save({ file });
4789+
48274790
await Parse.User.requestPasswordReset('[email protected]');
48284791
});
48294792

0 commit comments

Comments
 (0)