@@ -409,6 +409,46 @@ describe('rest create', () => {
409
409
} ) ;
410
410
} ) ;
411
411
412
+ //to be added to PR
413
+ it ( 'test facebook signup, login' , async ( ) => {
414
+ const data = {
415
+ authData : {
416
+ facebook : {
417
+ id : '8675309' ,
418
+ access_token : 'jenny' ,
419
+ } ,
420
+ } ,
421
+ } ;
422
+
423
+ let newUserSignedUpByFacebookObjectId ;
424
+
425
+ try {
426
+ const firstResponse = await rest . create ( config , auth . nobody ( config ) , '_User' , data ) ;
427
+
428
+ expect ( typeof firstResponse . response . objectId ) . toEqual ( 'string' ) ;
429
+ expect ( typeof firstResponse . response . createdAt ) . toEqual ( 'string' ) ;
430
+ expect ( typeof firstResponse . response . sessionToken ) . toEqual ( 'string' ) ;
431
+ newUserSignedUpByFacebookObjectId = firstResponse . response . objectId ;
432
+
433
+ const secondResponse = await rest . create ( config , auth . nobody ( config ) , '_User' , data ) ;
434
+
435
+ expect ( typeof secondResponse . response . objectId ) . toEqual ( 'string' ) ;
436
+ expect ( typeof secondResponse . response . createdAt ) . toEqual ( 'string' ) ;
437
+ expect ( typeof secondResponse . response . username ) . toEqual ( 'string' ) ;
438
+ expect ( typeof secondResponse . response . updatedAt ) . toEqual ( 'string' ) ;
439
+ expect ( secondResponse . response . objectId ) . toEqual ( newUserSignedUpByFacebookObjectId ) ;
440
+
441
+ const sessionResponse = await rest . find ( config , auth . master ( config ) , '_Session' , {
442
+ sessionToken : secondResponse . response . sessionToken ,
443
+ } ) ;
444
+
445
+ expect ( sessionResponse . results . length ) . toEqual ( 1 ) ;
446
+ const output = sessionResponse . results [ 0 ] ;
447
+ expect ( output . user . objectId ) . toEqual ( newUserSignedUpByFacebookObjectId ) ;
448
+ } catch ( err ) {
449
+ jfail ( err ) ;
450
+ }
451
+ } ) ;
412
452
it ( 'stores pointers' , done => {
413
453
const obj = {
414
454
foo : 'bar' ,
0 commit comments