Skip to content

Commit

Permalink
test: showSongById 스와이프 기능 테스트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
splitCoding committed Sep 27, 2023
1 parent 44b84ba commit 7a5fa6f
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.jdbc.Sql;
import shook.shook.auth.application.TokenProvider;
import shook.shook.song.application.InMemorySongsScheduler;
import shook.shook.song.application.dto.SongResponse;
import shook.shook.song.application.dto.SongSwipeResponse;
Expand All @@ -38,6 +40,9 @@ void setUp() {
RestAssured.port = port;
}

@Autowired
private TokenProvider tokenProvider;

@Autowired
private KillingPartLikeService likeService;

Expand All @@ -48,6 +53,8 @@ void setUp() {
@Test
void showSongById() {
//given
final String accessToken = tokenProvider.createAccessToken(1L, "nickname");

final Long songId = 2L;
likeService.updateLikeStatus(FIRST_SONG_KILLING_PART_ID_1, MEMBER_ID,
new KillingPartLikeRequest(true));
Expand All @@ -56,12 +63,11 @@ void showSongById() {
likeService.updateLikeStatus(SECOND_SONG_KILLING_PART_ID_1, MEMBER_ID,
new KillingPartLikeRequest(true));

// 정렬 순서: 1L, 2L, 4L, 3L
inMemorySongsScheduler.recreateCachedSong();

// 정렬 순서: 1L, 2L, 4L, 3L
//when
final SongSwipeResponse response = RestAssured.given().log().all()
.param("memberId", MEMBER_ID)
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken)
.when().log().all()
.get("/songs/high-liked/{song_id}", songId)
.then().log().all()
Expand Down

0 comments on commit 7a5fa6f

Please sign in to comment.