Skip to content

Commit 407825d

Browse files
committed
tests
1 parent 78c67d4 commit 407825d

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

spec/PagesRouter.spec.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,11 @@ describe('Pages Router', () => {
658658
const appId = linkResponse.headers['x-parse-page-param-appid'];
659659
const token = linkResponse.headers['x-parse-page-param-token'];
660660
const locale = linkResponse.headers['x-parse-page-param-locale'];
661-
const username = linkResponse.headers['x-parse-page-param-username'];
662661
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
663662
const passwordResetPagePath = pageResponse.calls.all()[0].args[0];
664663
expect(appId).toBeDefined();
665664
expect(token).toBeDefined();
666665
expect(locale).toBeDefined();
667-
expect(username).toBeDefined();
668666
expect(publicServerUrl).toBeDefined();
669667
expect(passwordResetPagePath).toMatch(
670668
new RegExp(`\/${exampleLocale}\/${pages.passwordReset.defaultFile}`)
@@ -678,7 +676,6 @@ describe('Pages Router', () => {
678676
body: {
679677
token,
680678
locale,
681-
username,
682679
new_password: 'newPassword',
683680
},
684681
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
@@ -773,15 +770,13 @@ describe('Pages Router', () => {
773770

774771
const appId = linkResponse.headers['x-parse-page-param-appid'];
775772
const locale = linkResponse.headers['x-parse-page-param-locale'];
776-
const username = linkResponse.headers['x-parse-page-param-username'];
777773
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
778774
const invalidVerificationPagePath = pageResponse.calls.all()[0].args[0];
779775
expect(appId).toBeDefined();
780776
expect(locale).toBe(exampleLocale);
781-
expect(username).toBeDefined();
782777
expect(publicServerUrl).toBeDefined();
783778
expect(invalidVerificationPagePath).toMatch(
784-
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkExpired.defaultFile}`)
779+
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkInvalid.defaultFile}`)
785780
);
786781

787782
const formUrl = `${publicServerUrl}/apps/${appId}/resend_verification_email`;
@@ -790,7 +785,7 @@ describe('Pages Router', () => {
790785
method: 'POST',
791786
body: {
792787
locale,
793-
username,
788+
username: 'exampleUsername',
794789
},
795790
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
796791
followRedirects: false,
@@ -826,15 +821,13 @@ describe('Pages Router', () => {
826821

827822
const appId = linkResponse.headers['x-parse-page-param-appid'];
828823
const locale = linkResponse.headers['x-parse-page-param-locale'];
829-
const username = linkResponse.headers['x-parse-page-param-username'];
830824
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
831825
const invalidVerificationPagePath = pageResponse.calls.all()[0].args[0];
832826
expect(appId).toBeDefined();
833827
expect(locale).toBe(exampleLocale);
834-
expect(username).toBeDefined();
835828
expect(publicServerUrl).toBeDefined();
836829
expect(invalidVerificationPagePath).toMatch(
837-
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkExpired.defaultFile}`)
830+
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkInvalid.defaultFile}`)
838831
);
839832

840833
spyOn(UserController.prototype, 'resendVerificationEmail').and.callFake(() =>
@@ -847,7 +840,7 @@ describe('Pages Router', () => {
847840
method: 'POST',
848841
body: {
849842
locale,
850-
username,
843+
username: 'exampleUsername',
851844
},
852845
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
853846
followRedirects: false,
@@ -1132,12 +1125,10 @@ describe('Pages Router', () => {
11321125

11331126
const appId = linkResponse.headers['x-parse-page-param-appid'];
11341127
const token = linkResponse.headers['x-parse-page-param-token'];
1135-
const username = linkResponse.headers['x-parse-page-param-username'];
11361128
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
11371129
const passwordResetPagePath = pageResponse.calls.all()[0].args[0];
11381130
expect(appId).toBeDefined();
11391131
expect(token).toBeDefined();
1140-
expect(username).toBeDefined();
11411132
expect(publicServerUrl).toBeDefined();
11421133
expect(passwordResetPagePath).toMatch(new RegExp(`\/${pages.passwordReset.defaultFile}`));
11431134
pageResponse.calls.reset();
@@ -1148,7 +1139,6 @@ describe('Pages Router', () => {
11481139
method: 'POST',
11491140
body: {
11501141
token,
1151-
username,
11521142
new_password: 'newPassword',
11531143
},
11541144
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

spec/ParseLiveQuery.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ describe('ParseLiveQuery', function () {
10371037
const userController = new UserController(emailAdapter, 'test', {
10381038
verifyUserEmails: true,
10391039
});
1040-
userController.verifyEmail(foundUser.username, foundUser._email_verify_token);
1040+
userController.verifyEmail(foundUser._email_verify_token);
10411041
});
10421042
});
10431043
});

src/Controllers/UserController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class UserController extends AdaptableController {
7171
}
7272
const maintenanceAuth = Auth.maintenance(this.config);
7373
const result = await new RestQuery(this.config, maintenanceAuth, '_User', query).execute();
74-
if (result.results.length && result.results[0].emailVerified) {
74+
if (result.results.length) {
7575
query.objectId = result.results[0].objectId;
7676
}
7777
return await rest.update(this.config, maintenanceAuth, '_User', query, updateFields);

src/Routers/PagesRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class PagesRouter extends PromiseRouter {
100100
return this.goToPage(req, pages.emailVerificationSuccess);
101101
},
102102
() => {
103-
return this.goToPage(req, pages.emailVerificationLinkExpired);
103+
return this.goToPage(req, pages.emailVerificationLinkInvalid);
104104
}
105105
);
106106
}

0 commit comments

Comments
 (0)