@@ -25,7 +25,6 @@ describe('AuthenticationProviders', function () {
2525 'gcenter' ,
2626 'gpgames' ,
2727 'facebook' ,
28- 'facebookaccountkit' ,
2928 'github' ,
3029 'instagram' ,
3130 'google' ,
@@ -43,7 +42,7 @@ describe('AuthenticationProviders', function () {
4342 'phantauth' ,
4443 'microsoft' ,
4544 ] . map ( function ( providerName ) {
46- it ( 'Should validate structure of ' + providerName , ( done ) => {
45+ it ( 'Should validate structure of ' + providerName , done => {
4746 const provider = require ( '../lib/Adapters/Auth/' + providerName ) ;
4847 jequal ( typeof provider . validateAuthData , 'function' ) ;
4948 jequal ( typeof provider . validateAppId , 'function' ) ;
@@ -71,7 +70,7 @@ describe('AuthenticationProviders', function () {
7170 return ;
7271 }
7372 spyOn ( require ( '../lib/Adapters/Auth/httpsRequest' ) , 'get' ) . and . callFake (
74- ( options ) => {
73+ options => {
7574 if (
7675 options ===
7776 '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 () {
175174 body : jsonBody ,
176175 } ;
177176 return request ( options )
178- . then ( ( response ) => {
177+ . then ( response => {
179178 if ( callback ) {
180179 callback ( null , response , response . data ) ;
181180 }
@@ -184,15 +183,15 @@ describe('AuthenticationProviders', function () {
184183 body : response . data ,
185184 } ;
186185 } )
187- . catch ( ( error ) => {
186+ . catch ( error => {
188187 if ( callback ) {
189188 callback ( error ) ;
190189 }
191190 throw error ;
192191 } ) ;
193192 } ;
194193
195- it ( 'should create user with REST API' , ( done ) => {
194+ it ( 'should create user with REST API' , done => {
196195 createOAuthUser ( ( error , response , body ) => {
197196 expect ( error ) . toBe ( null ) ;
198197 const b = body ;
@@ -203,7 +202,7 @@ describe('AuthenticationProviders', function () {
203202 const q = new Parse . Query ( '_Session' ) ;
204203 q . equalTo ( 'sessionToken' , sessionToken ) ;
205204 q . first ( { useMasterKey : true } )
206- . then ( ( res ) => {
205+ . then ( res => {
207206 if ( ! res ) {
208207 fail ( 'should not fail fetching the session' ) ;
209208 done ( ) ;
@@ -219,7 +218,7 @@ describe('AuthenticationProviders', function () {
219218 } ) ;
220219 } ) ;
221220
222- it ( 'should only create a single user with REST API' , ( done ) => {
221+ it ( 'should only create a single user with REST API' , done => {
223222 let objectId ;
224223 createOAuthUser ( ( error , response , body ) => {
225224 expect ( error ) . toBe ( null ) ;
@@ -239,9 +238,9 @@ describe('AuthenticationProviders', function () {
239238 } ) ;
240239 } ) ;
241240
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 => {
243242 Parse . User . signUp ( 'myUser' , 'password' )
244- . then ( ( user ) => {
243+ . then ( user => {
245244 return createOAuthUserWithSessionToken ( user . getSessionToken ( ) ) ;
246245 } )
247246 . then ( ( ) => {
@@ -250,7 +249,7 @@ describe('AuthenticationProviders', function () {
250249 . then ( ( ) => {
251250 return Parse . User . signUp ( 'myUser2' , 'password' ) ;
252251 } )
253- . then ( ( user ) => {
252+ . then ( user => {
254253 return createOAuthUserWithSessionToken ( user . getSessionToken ( ) ) ;
255254 } )
256255 . then ( fail , ( { data } ) => {
@@ -330,7 +329,7 @@ describe('AuthenticationProviders', function () {
330329 expect ( typeof authAdapter . validateAppId ) . toBe ( 'function' ) ;
331330 }
332331
333- it ( 'properly loads custom adapter' , ( done ) => {
332+ it ( 'properly loads custom adapter' , done => {
334333 const validAuthData = {
335334 id : 'hello' ,
336335 token : 'world' ,
@@ -370,14 +369,14 @@ describe('AuthenticationProviders', function () {
370369 expect ( appIdSpy ) . not . toHaveBeenCalled ( ) ;
371370 done ( ) ;
372371 } ,
373- ( err ) => {
372+ err => {
374373 jfail ( err ) ;
375374 done ( ) ;
376375 }
377376 ) ;
378377 } ) ;
379378
380- it ( 'properly loads custom adapter module object' , ( done ) => {
379+ it ( 'properly loads custom adapter module object' , done => {
381380 const authenticationHandler = authenticationLoader ( {
382381 customAuthentication : path . resolve ( './spec/support/CustomAuth.js' ) ,
383382 } ) ;
@@ -394,14 +393,14 @@ describe('AuthenticationProviders', function () {
394393 ( ) => {
395394 done ( ) ;
396395 } ,
397- ( err ) => {
396+ err => {
398397 jfail ( err ) ;
399398 done ( ) ;
400399 }
401400 ) ;
402401 } ) ;
403402
404- it ( 'properly loads custom adapter module object (again)' , ( done ) => {
403+ it ( 'properly loads custom adapter module object (again)' , done => {
405404 const authenticationHandler = authenticationLoader ( {
406405 customAuthentication : {
407406 module : path . resolve ( './spec/support/CustomAuthFunction.js' ) ,
@@ -421,7 +420,7 @@ describe('AuthenticationProviders', function () {
421420 ( ) => {
422421 done ( ) ;
423422 } ,
424- ( err ) => {
423+ err => {
425424 jfail ( err ) ;
426425 done ( ) ;
427426 }
@@ -512,84 +511,6 @@ describe('AuthenticationProviders', function () {
512511 expect ( appIds ) . toEqual ( [ 'a' , 'b' ] ) ;
513512 expect ( providerOptions ) . toEqual ( options . custom ) ;
514513 } ) ;
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- } ) ;
593514} ) ;
594515
595516describe ( 'instagram auth adapter' , ( ) => {
@@ -1653,13 +1574,13 @@ describe('microsoft graph auth adapter', () => {
16531574 } ) ;
16541575 } ) ;
16551576
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 => {
16571578 const authData = {
16581579 id : 'fake-id' ,
1659158016601581 access_token : 'very.long.bad.token' ,
16611582 } ;
1662- microsoft . validateAuthData ( authData ) . then ( done . fail , ( err ) => {
1583+ microsoft . validateAuthData ( authData ) . then ( done . fail , err => {
16631584 expect ( err . code ) . toBe ( 101 ) ;
16641585 expect ( err . message ) . toBe (
16651586 'Microsoft Graph auth is invalid for this user.'
0 commit comments