@@ -46,10 +46,8 @@ describe('Password Policy: ', () => {
4646 resolveWithFullResponse : true ,
4747 } )
4848 . then ( response => {
49- expect ( response . status ) . toEqual ( 302 ) ;
50- expect ( response . text ) . toEqual (
51- 'Found. Redirecting to http://localhost:8378/1/apps/invalid_link.html'
52- ) ;
49+ expect ( response . status ) . toEqual ( 200 ) ;
50+ expect ( response . text ) . toContain ( 'Invalid password reset link!' ) ;
5351 done ( ) ;
5452 } )
5553 . catch ( error => {
@@ -106,9 +104,8 @@ describe('Password Policy: ', () => {
106104 followRedirects : false ,
107105 } )
108106 . then ( response => {
109- expect ( response . status ) . toEqual ( 302 ) ;
110- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = [ a - z A - Z 0 - 9 ] + \& i d = t e s t \& / ;
111- expect ( response . text . match ( re ) ) . not . toBe ( null ) ;
107+ expect ( response . status ) . toEqual ( 200 ) ;
108+ expect ( response . text ) . toContain ( 'password' ) ;
112109 done ( ) ;
113110 } )
114111 . catch ( error => {
@@ -621,8 +618,8 @@ describe('Password Policy: ', () => {
621618 resolveWithFullResponse : true ,
622619 } )
623620 . then ( response => {
624- expect ( response . status ) . toEqual ( 302 ) ;
625- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
621+ expect ( response . status ) . toEqual ( 200 ) ;
622+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
626623 const match = response . text . match ( re ) ;
627624 if ( ! match ) {
628625 fail ( 'should have a token' ) ;
@@ -643,10 +640,8 @@ describe('Password Policy: ', () => {
643640 resolveWithFullResponse : true ,
644641 } )
645642 . then ( response => {
646- expect ( response . status ) . toEqual ( 302 ) ;
647- expect ( response . text ) . toEqual (
648- 'Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html'
649- ) ;
643+ expect ( response . status ) . toEqual ( 200 ) ;
644+ expect ( response . text ) . toContain ( 'Success!' ) ;
650645
651646 Parse . User . logIn ( 'user1' , 'has2init' )
652647 . then ( function ( ) {
@@ -713,8 +708,8 @@ describe('Password Policy: ', () => {
713708 resolveWithFullResponse : true ,
714709 } )
715710 . then ( response => {
716- expect ( response . status ) . toEqual ( 302 ) ;
717- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
711+ expect ( response . status ) . toEqual ( 200 ) ;
712+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
718713 const match = response . text . match ( re ) ;
719714 if ( ! match ) {
720715 fail ( 'should have a token' ) ;
@@ -735,10 +730,8 @@ describe('Password Policy: ', () => {
735730 resolveWithFullResponse : true ,
736731 } )
737732 . then ( response => {
738- expect ( response . status ) . toEqual ( 302 ) ;
739- expect ( response . text ) . toEqual (
740- `Found. Redirecting to http://localhost:8378/1/apps/choose_password?token=${ token } &id=test&error=Password%20should%20contain%20at%20least%20one%20digit.&app=passwordPolicy`
741- ) ;
733+ expect ( response . status ) . toEqual ( 200 ) ;
734+ expect ( response . text ) . toContain ( 'Password should contain at least one digit.' ) ;
742735
743736 Parse . User . logIn ( 'user1' , 'has 1 digit' )
744737 . then ( function ( ) {
@@ -899,8 +892,8 @@ describe('Password Policy: ', () => {
899892 resolveWithFullResponse : true ,
900893 } )
901894 . then ( response => {
902- expect ( response . status ) . toEqual ( 302 ) ;
903- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
895+ expect ( response . status ) . toEqual ( 200 ) ;
896+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
904897 const match = response . text . match ( re ) ;
905898 if ( ! match ) {
906899 fail ( 'should have a token' ) ;
@@ -921,10 +914,8 @@ describe('Password Policy: ', () => {
921914 resolveWithFullResponse : true ,
922915 } )
923916 . then ( response => {
924- expect ( response . status ) . toEqual ( 302 ) ;
925- expect ( response . text ) . toEqual (
926- `Found. Redirecting to http://localhost:8378/1/apps/choose_password?token=${ token } &id=test&error=Password%20cannot%20contain%20your%20username.&app=passwordPolicy`
927- ) ;
917+ expect ( response . status ) . toEqual ( 200 ) ;
918+ expect ( response . text ) . toContain ( 'Password cannot contain your username.' ) ;
928919
929920 Parse . User . logIn ( 'user1' , 'r@nd0m' )
930921 . then ( function ( ) {
@@ -990,8 +981,8 @@ describe('Password Policy: ', () => {
990981 simple : false ,
991982 resolveWithFullResponse : true ,
992983 } ) ;
993- expect ( response . status ) . toEqual ( 302 ) ;
994- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
984+ expect ( response . status ) . toEqual ( 200 ) ;
985+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
995986 const match = response . text . match ( re ) ;
996987 if ( ! match ) {
997988 fail ( 'should have a token' ) ;
@@ -1050,8 +1041,8 @@ describe('Password Policy: ', () => {
10501041 resolveWithFullResponse : true ,
10511042 } )
10521043 . then ( response => {
1053- expect ( response . status ) . toEqual ( 302 ) ;
1054- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
1044+ expect ( response . status ) . toEqual ( 200 ) ;
1045+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
10551046 const match = response . text . match ( re ) ;
10561047 if ( ! match ) {
10571048 fail ( 'should have a token' ) ;
@@ -1072,10 +1063,8 @@ describe('Password Policy: ', () => {
10721063 resolveWithFullResponse : true ,
10731064 } )
10741065 . then ( response => {
1075- expect ( response . status ) . toEqual ( 302 ) ;
1076- expect ( response . text ) . toEqual (
1077- 'Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html'
1078- ) ;
1066+ expect ( response . status ) . toEqual ( 200 ) ;
1067+ expect ( response . text ) . toContain ( 'Success!' ) ;
10791068
10801069 Parse . User . logIn ( 'user1' , 'uuser11' )
10811070 . then ( function ( ) {
@@ -1316,8 +1305,8 @@ describe('Password Policy: ', () => {
13161305 resolveWithFullResponse : true ,
13171306 } )
13181307 . then ( response => {
1319- expect ( response . status ) . toEqual ( 302 ) ;
1320- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
1308+ expect ( response . status ) . toEqual ( 200 ) ;
1309+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
13211310 const match = response . text . match ( re ) ;
13221311 if ( ! match ) {
13231312 fail ( 'should have a token' ) ;
@@ -1338,10 +1327,8 @@ describe('Password Policy: ', () => {
13381327 resolveWithFullResponse : true ,
13391328 } )
13401329 . then ( response => {
1341- expect ( response . status ) . toEqual ( 302 ) ;
1342- expect ( response . text ) . toEqual (
1343- 'Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html'
1344- ) ;
1330+ expect ( response . status ) . toEqual ( 200 ) ;
1331+ expect ( response . text ) . toContain ( 'Success!' ) ;
13451332
13461333 Parse . User . logIn ( 'user1' , 'uuser11' )
13471334 . then ( function ( ) {
@@ -1471,8 +1458,8 @@ describe('Password Policy: ', () => {
14711458 followRedirects : false ,
14721459 } )
14731460 . then ( response => {
1474- expect ( response . status ) . toEqual ( 302 ) ;
1475- const re = / h t t p : \/ \/ l o c a l h o s t : 8 3 7 8 \/ 1 \/ a p p s \/ c h o o s e _ p a s s w o r d \? t o k e n = ( [ a - z A - Z 0 - 9 ] + ) \& i d = t e s t \& / ;
1461+ expect ( response . status ) . toEqual ( 200 ) ;
1462+ const re = / n a m e = " t o k e n " [ ^ > ] * v a l u e = " ( [ ^ " ] + ) " / ;
14761463 const match = response . text . match ( re ) ;
14771464 if ( ! match ) {
14781465 fail ( 'should have a token' ) ;
@@ -1498,10 +1485,8 @@ describe('Password Policy: ', () => {
14981485 . then ( data => {
14991486 const response = data [ 0 ] ;
15001487 const token = data [ 1 ] ;
1501- expect ( response . status ) . toEqual ( 302 ) ;
1502- expect ( response . text ) . toEqual (
1503- `Found. Redirecting to http://localhost:8378/1/apps/choose_password?token=${ token } &id=test&error=New%20password%20should%20not%20be%20the%20same%20as%20last%201%20passwords.&app=passwordPolicy`
1504- ) ;
1488+ expect ( response . status ) . toEqual ( 200 ) ;
1489+ expect ( response . text ) . toContain ( 'New password should not be the same as last 1 passwords.' ) ;
15051490 done ( ) ;
15061491 return Promise . resolve ( ) ;
15071492 } )
0 commit comments