33import static com .example .solidconnection .mentor .domain .ChannelType .BLOG ;
44import static com .example .solidconnection .mentor .domain .ChannelType .INSTAGRAM ;
55import static org .assertj .core .api .Assertions .assertThat ;
6+ import static org .assertj .core .api .Assertions .tuple ;
67import static org .junit .jupiter .api .Assertions .assertAll ;
78
89import com .example .solidconnection .mentor .domain .Channel ;
@@ -109,8 +110,28 @@ class 멘토의_마이_페이지를_수정한다 {
109110 }
110111
111112 @ Test
112- void 채널_정보를_수정한다 () {
113+ void 기존보다_적게_채널_정보를_수정한다 () {
113114 // given
115+ channelFixture .채널 (1 , mentor );
116+ channelFixture .채널 (2 , mentor );
117+ channelFixture .채널 (3 , mentor );
118+ channelFixture .채널 (4 , mentor );
119+ List <ChannelRequest > newChannels = List .of (new ChannelRequest (BLOG , "https://blog.com" ));
120+ MentorMyPageUpdateRequest request = new MentorMyPageUpdateRequest ("introduction" , "passTip" , newChannels );
121+
122+ // when
123+ mentorMyPageService .updateMentorMyPage (mentorUser .getId (), request );
124+
125+ // then
126+ List <Channel > updatedChannels = channelRepositoryForTest .findAllByMentorId (mentor .getId ());
127+ assertThat (updatedChannels ).extracting (Channel ::getSequence , Channel ::getType , Channel ::getUrl )
128+ .containsExactlyInAnyOrder (tuple (1 , BLOG , "https://blog.com" ));
129+ }
130+
131+ @ Test
132+ void 기존보다_많게_채널_정보를_수정한다 () {
133+ // given
134+ channelFixture .채널 (1 , mentor );
114135 List <ChannelRequest > newChannels = List .of (
115136 new ChannelRequest (BLOG , "https://blog.com" ),
116137 new ChannelRequest (INSTAGRAM , "https://instagram.com" )
@@ -122,12 +143,11 @@ class 멘토의_마이_페이지를_수정한다 {
122143
123144 // then
124145 List <Channel > updatedChannels = channelRepositoryForTest .findAllByMentorId (mentor .getId ());
125- assertAll (
126- () -> assertThat (updatedChannels ).extracting (Channel ::getType )
127- .containsExactly (BLOG , INSTAGRAM ),
128- () -> assertThat (updatedChannels ).extracting (Channel ::getUrl )
129- .containsExactly ("https://blog.com" , "https://instagram.com" )
130- );
146+ assertThat (updatedChannels ).extracting (Channel ::getSequence , Channel ::getType , Channel ::getUrl )
147+ .containsExactlyInAnyOrder (
148+ tuple (1 , BLOG , "https://blog.com" ),
149+ tuple (2 , INSTAGRAM , "https://instagram.com" )
150+ );
131151 }
132152 }
133153}
0 commit comments