Skip to content

Commit d4ee888

Browse files
committed
fix tests
1 parent 38e6bae commit d4ee888

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/presentation/http/routes/posts.test.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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')

0 commit comments

Comments
 (0)