File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -658,6 +658,17 @@ describe('Parse User', () => {
658
658
expect ( user . doSomething ( ) ) . toBe ( 5 ) ;
659
659
} ) ;
660
660
661
+ it ( 'can become user with subclass static' , async ( ) => {
662
+ Parse . User . enableUnsafeCurrentUser ( ) ;
663
+
664
+ let user = await CustomUser . signUp ( 'username' , 'password' ) ;
665
+ const token = user . getSessionToken ( ) ;
666
+
667
+ user = await CustomUser . become ( token )
668
+ expect ( user instanceof CustomUser ) . toBe ( true ) ;
669
+ expect ( user . doSomething ( ) ) . toBe ( 5 ) ;
670
+ } ) ;
671
+
661
672
it ( 'can link without master key' , async ( ) => {
662
673
Parse . User . enableUnsafeCurrentUser ( ) ;
663
674
Original file line number Diff line number Diff line change @@ -649,7 +649,8 @@ class ParseUser extends ParseObject {
649
649
}
650
650
651
651
const controller = CoreManager . getUserController ( ) ;
652
- return controller . become ( becomeOptions ) ;
652
+ const user = new this ( ) ;
653
+ return controller . become ( user , becomeOptions ) ;
653
654
}
654
655
655
656
/**
@@ -990,8 +991,7 @@ const DefaultController = {
990
991
} ) ;
991
992
} ,
992
993
993
- become ( options : RequestOptions ) : Promise < ParseUser > {
994
- const user = new ParseUser ( ) ;
994
+ become ( user : ParseUser , options : RequestOptions ) : Promise < ParseUser > {
995
995
const RESTController = CoreManager . getRESTController ( ) ;
996
996
return RESTController . request (
997
997
'GET' , 'users/me' , { } , options
You can’t perform that action at this time.
0 commit comments