@@ -25,7 +25,6 @@ describe('AuthenticationProviders', function () {
25
25
'gcenter' ,
26
26
'gpgames' ,
27
27
'facebook' ,
28
- 'facebookaccountkit' ,
29
28
'github' ,
30
29
'instagram' ,
31
30
'google' ,
@@ -43,7 +42,7 @@ describe('AuthenticationProviders', function () {
43
42
'phantauth' ,
44
43
'microsoft' ,
45
44
] . map ( function ( providerName ) {
46
- it ( 'Should validate structure of ' + providerName , ( done ) => {
45
+ it ( 'Should validate structure of ' + providerName , done => {
47
46
const provider = require ( '../lib/Adapters/Auth/' + providerName ) ;
48
47
jequal ( typeof provider . validateAuthData , 'function' ) ;
49
48
jequal ( typeof provider . validateAppId , 'function' ) ;
@@ -71,7 +70,7 @@ describe('AuthenticationProviders', function () {
71
70
return ;
72
71
}
73
72
spyOn ( require ( '../lib/Adapters/Auth/httpsRequest' ) , 'get' ) . and . callFake (
74
- ( options ) => {
73
+ options => {
75
74
if (
76
75
options ===
77
76
'https://oauth.vk.com/access_token?client_id=appId&client_secret=appSecret&v=5.59&grant_type=client_credentials'
@@ -175,7 +174,7 @@ describe('AuthenticationProviders', function () {
175
174
body : jsonBody ,
176
175
} ;
177
176
return request ( options )
178
- . then ( ( response ) => {
177
+ . then ( response => {
179
178
if ( callback ) {
180
179
callback ( null , response , response . data ) ;
181
180
}
@@ -184,15 +183,15 @@ describe('AuthenticationProviders', function () {
184
183
body : response . data ,
185
184
} ;
186
185
} )
187
- . catch ( ( error ) => {
186
+ . catch ( error => {
188
187
if ( callback ) {
189
188
callback ( error ) ;
190
189
}
191
190
throw error ;
192
191
} ) ;
193
192
} ;
194
193
195
- it ( 'should create user with REST API' , ( done ) => {
194
+ it ( 'should create user with REST API' , done => {
196
195
createOAuthUser ( ( error , response , body ) => {
197
196
expect ( error ) . toBe ( null ) ;
198
197
const b = body ;
@@ -203,7 +202,7 @@ describe('AuthenticationProviders', function () {
203
202
const q = new Parse . Query ( '_Session' ) ;
204
203
q . equalTo ( 'sessionToken' , sessionToken ) ;
205
204
q . first ( { useMasterKey : true } )
206
- . then ( ( res ) => {
205
+ . then ( res => {
207
206
if ( ! res ) {
208
207
fail ( 'should not fail fetching the session' ) ;
209
208
done ( ) ;
@@ -219,7 +218,7 @@ describe('AuthenticationProviders', function () {
219
218
} ) ;
220
219
} ) ;
221
220
222
- it ( 'should only create a single user with REST API' , ( done ) => {
221
+ it ( 'should only create a single user with REST API' , done => {
223
222
let objectId ;
224
223
createOAuthUser ( ( error , response , body ) => {
225
224
expect ( error ) . toBe ( null ) ;
@@ -239,9 +238,9 @@ describe('AuthenticationProviders', function () {
239
238
} ) ;
240
239
} ) ;
241
240
242
- it ( "should fail to link if session token don't match user" , ( done ) => {
241
+ it ( "should fail to link if session token don't match user" , done => {
243
242
Parse . User . signUp ( 'myUser' , 'password' )
244
- . then ( ( user ) => {
243
+ . then ( user => {
245
244
return createOAuthUserWithSessionToken ( user . getSessionToken ( ) ) ;
246
245
} )
247
246
. then ( ( ) => {
@@ -250,7 +249,7 @@ describe('AuthenticationProviders', function () {
250
249
. then ( ( ) => {
251
250
return Parse . User . signUp ( 'myUser2' , 'password' ) ;
252
251
} )
253
- . then ( ( user ) => {
252
+ . then ( user => {
254
253
return createOAuthUserWithSessionToken ( user . getSessionToken ( ) ) ;
255
254
} )
256
255
. then ( fail , ( { data } ) => {
@@ -330,7 +329,7 @@ describe('AuthenticationProviders', function () {
330
329
expect ( typeof authAdapter . validateAppId ) . toBe ( 'function' ) ;
331
330
}
332
331
333
- it ( 'properly loads custom adapter' , ( done ) => {
332
+ it ( 'properly loads custom adapter' , done => {
334
333
const validAuthData = {
335
334
id : 'hello' ,
336
335
token : 'world' ,
@@ -370,14 +369,14 @@ describe('AuthenticationProviders', function () {
370
369
expect ( appIdSpy ) . not . toHaveBeenCalled ( ) ;
371
370
done ( ) ;
372
371
} ,
373
- ( err ) => {
372
+ err => {
374
373
jfail ( err ) ;
375
374
done ( ) ;
376
375
}
377
376
) ;
378
377
} ) ;
379
378
380
- it ( 'properly loads custom adapter module object' , ( done ) => {
379
+ it ( 'properly loads custom adapter module object' , done => {
381
380
const authenticationHandler = authenticationLoader ( {
382
381
customAuthentication : path . resolve ( './spec/support/CustomAuth.js' ) ,
383
382
} ) ;
@@ -394,14 +393,14 @@ describe('AuthenticationProviders', function () {
394
393
( ) => {
395
394
done ( ) ;
396
395
} ,
397
- ( err ) => {
396
+ err => {
398
397
jfail ( err ) ;
399
398
done ( ) ;
400
399
}
401
400
) ;
402
401
} ) ;
403
402
404
- it ( 'properly loads custom adapter module object (again)' , ( done ) => {
403
+ it ( 'properly loads custom adapter module object (again)' , done => {
405
404
const authenticationHandler = authenticationLoader ( {
406
405
customAuthentication : {
407
406
module : path . resolve ( './spec/support/CustomAuthFunction.js' ) ,
@@ -421,7 +420,7 @@ describe('AuthenticationProviders', function () {
421
420
( ) => {
422
421
done ( ) ;
423
422
} ,
424
- ( err ) => {
423
+ err => {
425
424
jfail ( err ) ;
426
425
done ( ) ;
427
426
}
@@ -512,84 +511,6 @@ describe('AuthenticationProviders', function () {
512
511
expect ( appIds ) . toEqual ( [ 'a' , 'b' ] ) ;
513
512
expect ( providerOptions ) . toEqual ( options . custom ) ;
514
513
} ) ;
515
-
516
- it ( 'properly loads Facebook accountkit adapter with options' , ( ) => {
517
- const options = {
518
- facebookaccountkit : {
519
- appIds : [ 'a' , 'b' ] ,
520
- appSecret : 'secret' ,
521
- } ,
522
- } ;
523
- const {
524
- adapter,
525
- appIds,
526
- providerOptions,
527
- } = authenticationLoader . loadAuthAdapter ( 'facebookaccountkit' , options ) ;
528
- validateAuthenticationAdapter ( adapter ) ;
529
- expect ( appIds ) . toEqual ( [ 'a' , 'b' ] ) ;
530
- expect ( providerOptions . appSecret ) . toEqual ( 'secret' ) ;
531
- } ) ;
532
-
533
- it ( 'should fail if Facebook appIds is not configured properly' , ( done ) => {
534
- const options = {
535
- facebookaccountkit : {
536
- appIds : [ ] ,
537
- } ,
538
- } ;
539
- const { adapter, appIds } = authenticationLoader . loadAuthAdapter (
540
- 'facebookaccountkit' ,
541
- options
542
- ) ;
543
- adapter . validateAppId ( appIds ) . then ( done . fail , ( err ) => {
544
- expect ( err . code ) . toBe ( Parse . Error . OBJECT_NOT_FOUND ) ;
545
- done ( ) ;
546
- } ) ;
547
- } ) ;
548
-
549
- it ( 'should fail to validate Facebook accountkit auth with bad token' , ( done ) => {
550
- const options = {
551
- facebookaccountkit : {
552
- appIds : [ 'a' , 'b' ] ,
553
- } ,
554
- } ;
555
- const authData = {
556
- id : 'fakeid' ,
557
- access_token : 'badtoken' ,
558
- } ;
559
- const { adapter } = authenticationLoader . loadAuthAdapter (
560
- 'facebookaccountkit' ,
561
- options
562
- ) ;
563
- adapter . validateAuthData ( authData ) . then ( done . fail , ( err ) => {
564
- expect ( err . code ) . toBe ( 190 ) ;
565
- expect ( err . type ) . toBe ( 'OAuthException' ) ;
566
- done ( ) ;
567
- } ) ;
568
- } ) ;
569
-
570
- it ( 'should fail to validate Facebook accountkit auth with bad token regardless of app secret proof' , ( done ) => {
571
- const options = {
572
- facebookaccountkit : {
573
- appIds : [ 'a' , 'b' ] ,
574
- appSecret : 'badsecret' ,
575
- } ,
576
- } ;
577
- const authData = {
578
- id : 'fakeid' ,
579
- access_token : 'badtoken' ,
580
- } ;
581
- const { adapter, providerOptions } = authenticationLoader . loadAuthAdapter (
582
- 'facebookaccountkit' ,
583
- options
584
- ) ;
585
- adapter
586
- . validateAuthData ( authData , providerOptions )
587
- . then ( done . fail , ( err ) => {
588
- expect ( err . code ) . toBe ( 190 ) ;
589
- expect ( err . type ) . toBe ( 'OAuthException' ) ;
590
- done ( ) ;
591
- } ) ;
592
- } ) ;
593
514
} ) ;
594
515
595
516
describe ( 'instagram auth adapter' , ( ) => {
@@ -1653,13 +1574,13 @@ describe('microsoft graph auth adapter', () => {
1653
1574
} ) ;
1654
1575
} ) ;
1655
1576
1656
- it ( 'should fail to validate Microsoft Graph auth with bad token' , ( done ) => {
1577
+ it ( 'should fail to validate Microsoft Graph auth with bad token' , done => {
1657
1578
const authData = {
1658
1579
id : 'fake-id' ,
1659
1580
1660
1581
access_token : 'very.long.bad.token' ,
1661
1582
} ;
1662
- microsoft . validateAuthData ( authData ) . then ( done . fail , ( err ) => {
1583
+ microsoft . validateAuthData ( authData ) . then ( done . fail , err => {
1663
1584
expect ( err . code ) . toBe ( 101 ) ;
1664
1585
expect ( err . message ) . toBe (
1665
1586
'Microsoft Graph auth is invalid for this user.'
0 commit comments