Skip to content

Commit

Permalink
test: 새로운 알림 확인 Controller 테스트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jjuny0310 committed Nov 10, 2023
1 parent eb359f3 commit 82cfed3
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ssafy.ssafsound.domain.notification.controller;

import com.ssafy.ssafsound.domain.notification.dto.GetCheckNotificationResDto;
import com.ssafy.ssafsound.domain.notification.dto.GetNotificationResDto;
import com.ssafy.ssafsound.global.docs.ControllerTest;
import com.ssafy.ssafsound.global.util.fixture.NotificationFixture;
Expand Down Expand Up @@ -58,4 +59,24 @@ void getNotificationsByCursor() {
)
);
}

@Test
@DisplayName("새로운 알림 확인")
void checkNewNotification() {
doReturn(new GetCheckNotificationResDto(true))
.when(notificationService)
.checkNotification(any());

restDocs.cookie(ACCESS_TOKEN)
.when().get("/notifications/new")
.then().log().all()
.statusCode(HttpStatus.OK.value())
.apply(document("notification/check-new_notification",
requestCookieAccessTokenMandatory(),
getEnvelopPatternWithData().andWithPrefix("data.",
fieldWithPath("isNew").type(JsonFieldType.BOOLEAN).description("새로운 알림이 있는지 여부, true면 확인하지 않은 알림이 있다는 의미.")
)
)
);
}
}

0 comments on commit 82cfed3

Please sign in to comment.