File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -425,6 +425,12 @@ class ParseUser extends ParseObject {
425
425
if (options.hasOwnProperty('installationId')) {
426
426
signupOptions . installationId = options . installationId ;
427
427
}
428
+ if (
429
+ options.hasOwnProperty('context') &&
430
+ Object . prototype . toString . call ( options . context ) === '[ object Object ] '
431
+ ) {
432
+ signupOptions . context = options . context ;
433
+ }
428
434
429
435
const controller = CoreManager.getUserController();
430
436
return controller.signUp(this, attrs, signupOptions);
Original file line number Diff line number Diff line change @@ -1681,6 +1681,30 @@ describe('ParseUser', () => {
1681
1681
expect ( user . existed ( ) ) . toBe ( true ) ;
1682
1682
} ) ;
1683
1683
1684
+ it ( 'can signup with context' , async ( ) => {
1685
+ CoreManager . setRESTController ( {
1686
+ ajax ( ) { } ,
1687
+ request ( ) {
1688
+ return Promise . resolve (
1689
+ {
1690
+ objectId : 'uid3' ,
1691
+ username : 'username' ,
1692
+ sessionToken : '123abc' ,
1693
+ } ,
1694
+ 200
1695
+ ) ;
1696
+ } ,
1697
+ } ) ;
1698
+ const controller = CoreManager . getRESTController ( ) ;
1699
+ jest . spyOn ( controller , 'request' ) ;
1700
+ const context = { a : 'a' } ;
1701
+ const user = new ParseUser ( ) ;
1702
+ user . setUsername ( 'name' ) ;
1703
+ user . setPassword ( 'pass' ) ;
1704
+ await user . signUp ( null , { context } ) ;
1705
+ expect ( controller . request . mock . calls [ 0 ] [ 3 ] . context ) . toEqual ( context ) ;
1706
+ } ) ;
1707
+
1684
1708
it ( 'can verify user password' , async ( ) => {
1685
1709
ParseUser . enableUnsafeCurrentUser ( ) ;
1686
1710
ParseUser . _clearCache ( ) ;
You can’t perform that action at this time.
0 commit comments