GET /api/posts API
=> PostsController의getPosts
Method
게시글 조회는 빈 값을 요청(Request) 받고, 조회된 Post 데이터들을 응답(Response) 받음.
GET /api/posts
API의 검증 로직
{ data: [] }
의 구조를 가진다.test("GET /api/posts API (getPosts) Integration Test Success Case, Not Found Posts Data", async () => {
const response = await supertest(app).get(`/api/posts`); // API의 HTTP Method & URL
// .query({}) // Request Query String
// .send({}); // Request Body
// 1. API의 status가 200
expect(response.status).toEqual(200);
// 2. API의 res 데이터는 { data : []}
expect(response.body).toEqual({ data: [] });
});