@@ -178,26 +178,26 @@ describe("QrCodeAuth", function () {
178
178
} ) ;
179
179
180
180
it ( "should successfully fetch the user device info" , function ( done ) {
181
- qrCodeAuthModel . storeUserDeviceInfo ( userDeviceInfoData ) ;
181
+ qrCodeAuthModel . storeUserDeviceInfo ( userDeviceInfoData ) . then ( ( response ) => {
182
+ chai
183
+ . request ( app )
184
+ . get ( `/auth/qr-code-auth?device_id=${ response . userDeviceInfoData . device_id } ` )
185
+ . end ( ( err , res ) => {
186
+ if ( err ) {
187
+ return done ( err ) ;
188
+ }
189
+ expect ( res ) . to . have . status ( 200 ) ;
190
+ expect ( res . body ) . to . be . a ( "object" ) ;
191
+ expect ( res . body . data . user_id ) . to . be . a ( "string" ) ;
192
+ expect ( res . body . data . device_info ) . to . be . a ( "string" ) ;
193
+ expect ( res . body . data . device_id ) . to . be . a ( "string" ) ;
194
+ expect ( res . body . data . authorization_status ) . to . be . a ( "string" ) ;
195
+ expect ( res . body . data . access_token ) . to . be . a ( "string" ) ;
196
+ expect ( res . body . message ) . to . equal ( `Authentication document retrieved successfully.` ) ;
182
197
183
- chai
184
- . request ( app )
185
- . get ( `/auth/qr-code-auth?device_id=${ userDeviceInfoData . device_id } ` )
186
- . end ( ( err , res ) => {
187
- if ( err ) {
188
- return done ( err ) ;
189
- }
190
- expect ( res ) . to . have . status ( 200 ) ;
191
- expect ( res . body ) . to . be . a ( "object" ) ;
192
- expect ( res . body . data . user_id ) . to . be . a ( "string" ) ;
193
- expect ( res . body . data . device_info ) . to . be . a ( "string" ) ;
194
- expect ( res . body . data . device_id ) . to . be . a ( "string" ) ;
195
- expect ( res . body . data . authorization_status ) . to . be . a ( "string" ) ;
196
- expect ( res . body . data . access_token ) . to . be . a ( "string" ) ;
197
- expect ( res . body . message ) . to . equal ( `Authentication document retrieved successfully.` ) ;
198
-
199
- return done ( ) ;
200
- } ) ;
198
+ return done ( ) ;
199
+ } ) ;
200
+ } ) ;
201
201
} ) ;
202
202
203
203
it ( "should fail with 404, when the document is not found" , function ( done ) {
0 commit comments