@@ -835,35 +835,30 @@ describe("review thread conversations", () => {
835835 comments : [ lastReply , { ...finding , body : "Stale finding" } , reply ] ,
836836 } ;
837837
838- it ( "keeps a timeline finding and its replies in one row at the finding time" , ( ) => {
838+ it ( "keeps a timeline finding and replies together at the latest activity time" , ( ) => {
839839 const events = buildPullRequestTimeline ( {
840840 ...TIMELINE_SOURCE ,
841841 comments,
842842 reviewThreads : [ thread ] ,
843843 } ) ;
844- expect ( events . map ( ( event ) => event . id ) ) . toEqual ( [ "c1" , "finding" , "1baf7bdcafe" , "created" ] ) ;
845- expect ( events [ 1 ] ) . toMatchObject ( {
846- id : finding . id ,
847- at : finding . createdAt ,
848- body : finding . body ,
849- url : finding . url ,
850- thread : {
851- path : thread . path ,
852- line : 7 ,
853- isOutdated : true ,
854- replies : [
855- { id : reply . id , body : reply . body , url : reply . url , reactions : reply . reactions } ,
856- { id : lastReply . id , body : lastReply . body , url : lastReply . url } ,
857- ] ,
858- } ,
844+ expect ( events . map ( ( event ) => event . id ) ) . toEqual ( [
845+ "thread:thread" ,
846+ "c1" ,
847+ "1baf7bdcafe" ,
848+ "created" ,
849+ ] ) ;
850+ expect ( events [ 0 ] ) . toMatchObject ( {
851+ at : lastReply . createdAt ,
852+ reviewThread : { ...thread , comments : [ finding , reply , lastReply ] } ,
859853 } ) ;
854+ expect ( events [ 0 ] ?. reviewThread ?. comments ) . toEqual ( [ finding , reply , lastReply ] ) ;
860855 expect ( groupPullRequestTimelineConversations ( events ) . map ( ( row ) => row . kind ) ) . toEqual ( [
861- "comments" ,
862856 "event" ,
857+ "comments" ,
863858 "event" ,
864859 "event" ,
865860 ] ) ;
866- expect ( events [ 0 ] ) . toEqual ( buildPullRequestTimeline ( TIMELINE_SOURCE ) [ 0 ] ) ;
861+ expect ( events [ 1 ] ) . toEqual ( buildPullRequestTimeline ( TIMELINE_SOURCE ) [ 0 ] ) ;
867862 } ) ;
868863
869864 it ( "orders and pages whole Summary conversations while retaining editable comment copies" , ( ) => {
@@ -921,24 +916,25 @@ describe("review thread conversations", () => {
921916 ) ;
922917 } ) ;
923918
924- it ( "distinguishes unloaded replies from complete threads, even when the host only supplies a cursor" , ( ) => {
925- const timeline = ( reviewThread : PullRequestReviewThread ) =>
926- buildPullRequestTimeline ( {
919+ it ( "retains reply pagination metadata for the shared review thread card" , ( ) => {
920+ for ( const reviewThread of [
921+ { ...thread , commentCount : 5 } ,
922+ { ...thread , nextCommentsCursor : "next" } ,
923+ thread ,
924+ ] ) {
925+ const timeline = buildPullRequestTimeline ( {
927926 ...TIMELINE_SOURCE ,
928927 comments,
929928 reviewThreads : [ reviewThread ] ,
930- } ) . find ( ( event ) => event . id === finding . id ) ?. thread ;
931- expect ( timeline ( { ...thread , commentCount : 5 } ) ) . toMatchObject ( {
932- moreReplies : 2 ,
933- hasMoreReplies : true ,
934- url : finding . url ,
935- } ) ;
936- expect ( timeline ( { ...thread , nextCommentsCursor : "next" } ) ) . toMatchObject ( {
937- moreReplies : 0 ,
938- hasMoreReplies : true ,
939- url : finding . url ,
940- } ) ;
941- expect ( timeline ( thread ) ) . toMatchObject ( { moreReplies : 0 , hasMoreReplies : false } ) ;
929+ } ) ;
930+ expect ( timeline . find ( ( event ) => event . id === "thread:thread" ) ?. reviewThread ) . toMatchObject ( {
931+ ...reviewThread ,
932+ comments : [ finding , reply , lastReply ] ,
933+ } ) ;
934+ expect (
935+ timeline . filter ( ( event ) => [ finding . id , reply . id , lastReply . id ] . includes ( event . id ) ) ,
936+ ) . toEqual ( [ ] ) ;
937+ }
942938 } ) ;
943939} ) ;
944940
0 commit comments