File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
tests/presentation/http/routes Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -77,16 +77,13 @@ describe('post routes test', () => {
7777 afterEach ( ( ) => {
7878 postsService . listUserPosts . restore ( ) ;
7979 } ) ;
80- it ( 'should return 200 an array of posts' , ( done ) => {
80+ it ( 'should return 200 an array of posts' , async ( ) => {
8181 postsService . listUserPosts . resolves ( postData ) ;
82- request ( app )
82+ const res = await request ( app )
8383 . get ( '/users/5fb02910c74ce3697859cee2/posts' )
84- . set ( 'Authorization' , `Bearer ${ testToken } ` )
85- . expect ( 200 )
86- . then ( ( res ) => {
87- expect ( res . body . length ) . to . eql ( postData . length ) ;
88- return done ( ) ;
89- } ) ;
84+ . set ( 'Authorization' , `Bearer ${ testToken } ` ) ;
85+ expect ( res . statusCode ) . to . to . eql ( 200 ) ;
86+ expect ( res . body . length ) . to . to . eql ( postData . length ) ;
9087 } ) ;
9188 it ( 'should return 403 when no token send' , ( ) => request ( app )
9289 . get ( '/users/5fb02910c74ce3697859cee2/posts' )
You can’t perform that action at this time.
0 commit comments