File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1055,6 +1055,13 @@ describe("Users", function () {
1055
1055
} ) ;
1056
1056
} ) ;
1057
1057
it ( "Should update the user" , async function ( ) {
1058
+ // Create a stub for the migrate function
1059
+ const migrateStub = sinon . stub ( controller , "migrate" ) ;
1060
+ // Define the desired behavior of the stub
1061
+ migrateStub . returns ( userData [ 0 ] ) . resolves ( {
1062
+ empty : true ,
1063
+ forEach : sinon . stub ( ) ,
1064
+ } ) ;
1058
1065
const usersMigrateResponse = await chai
1059
1066
. request ( app )
1060
1067
. post ( `/users/migrate` )
@@ -1067,15 +1074,13 @@ describe("Users", function () {
1067
1074
totalCount : 0 ,
1068
1075
} ,
1069
1076
} ) ;
1070
- sinon . stub ( controller , "migrate" ) . returns ( userData [ 0 ] ) . resolves ( {
1071
- empty : true ,
1072
- forEach : sinon . stub ( ) ,
1073
- } ) ;
1074
1077
const usersReponse = await chai . request ( app ) . get ( `/users` ) . set ( "cookie" , `${ cookieName } =${ superUserAuthToken } ` ) ;
1075
1078
expect ( usersReponse ) . to . have . status ( 200 ) ;
1076
1079
usersReponse . body . users . forEach ( ( document ) => {
1077
1080
expect ( document ) . to . have . property ( `github_user_id` ) ;
1078
1081
} ) ;
1082
+ // Restore the original migrate function
1083
+ migrateStub . restore ( ) ;
1079
1084
} ) ;
1080
1085
it ( "Should return unauthorized error when not logged in" , function ( done ) {
1081
1086
chai
You can’t perform that action at this time.
0 commit comments