@@ -96,6 +96,7 @@ describe('mutation updateUserInfo', () => {
9696 country
9797 city
9898 }
99+ hideExperience
99100 }
100101 }
101102 ` ;
@@ -662,4 +663,53 @@ describe('mutation updateUserInfo', () => {
662663 expect ( updatedUser ?. readmeHtml ) . toContain ( '<h1>' ) ;
663664 // locationId check skipped - requires DatasetLocation records
664665 } ) ;
666+
667+ it ( 'should update hideExperience' , async ( ) => {
668+ loggedUser = '1' ;
669+ const repo = con . getRepository ( User ) ;
670+
671+ // Verify initial state is false
672+ const user = await repo . findOneBy ( { id : loggedUser } ) ;
673+ expect ( user ?. hideExperience ) . toBe ( false ) ;
674+
675+ const res = await client . mutate ( MUTATION , {
676+ variables : {
677+ data : {
678+ hideExperience : true ,
679+ username : 'testuser' ,
680+ name : 'Test User' ,
681+ } ,
682+ } ,
683+ } ) ;
684+
685+ expect ( res . errors ) . toBeFalsy ( ) ;
686+ expect ( res . data . updateUserInfo . hideExperience ) . toBe ( true ) ;
687+
688+ const updatedUser = await repo . findOneBy ( { id : loggedUser } ) ;
689+ expect ( updatedUser ?. hideExperience ) . toBe ( true ) ;
690+ } ) ;
691+
692+ it ( 'should update hideExperience to false' , async ( ) => {
693+ loggedUser = '1' ;
694+ const repo = con . getRepository ( User ) ;
695+
696+ // Set hideExperience to true first
697+ await repo . update ( { id : loggedUser } , { hideExperience : true } ) ;
698+
699+ const res = await client . mutate ( MUTATION , {
700+ variables : {
701+ data : {
702+ hideExperience : false ,
703+ username : 'testuser' ,
704+ name : 'Test User' ,
705+ } ,
706+ } ,
707+ } ) ;
708+
709+ expect ( res . errors ) . toBeFalsy ( ) ;
710+ expect ( res . data . updateUserInfo . hideExperience ) . toBe ( false ) ;
711+
712+ const updatedUser = await repo . findOneBy ( { id : loggedUser } ) ;
713+ expect ( updatedUser ?. hideExperience ) . toBe ( false ) ;
714+ } ) ;
665715} ) ;
0 commit comments