@@ -55,6 +55,8 @@ function renderActions(
5555) {
5656 const options : Parameters < typeof usePullRequestReviewActions > [ 0 ] = {
5757 activeWorkspace : workspace ,
58+ activeThreadId : "thread-active" ,
59+ reviewDeliveryMode : "detached" ,
5860 pullRequest,
5961 pullRequestDiffs : diffs ,
6062 pullRequestComments : comments ,
@@ -68,7 +70,7 @@ function renderActions(
6870}
6971
7072describe ( "usePullRequestReviewActions" , ( ) => {
71- it ( "always starts a new thread for PR review" , async ( ) => {
73+ it ( "starts a new thread for detached PR review" , async ( ) => {
7274 const { result, options } = renderActions ( ) ;
7375
7476 await act ( async ( ) => {
@@ -131,4 +133,23 @@ describe("usePullRequestReviewActions", () => {
131133 expect ( options . startThreadForWorkspace ) . toHaveBeenCalledTimes ( 1 ) ;
132134 expect ( options . sendUserMessageToThread ) . toHaveBeenCalledTimes ( 1 ) ;
133135 } ) ;
136+
137+ it ( "reuses the active thread for inline PR review" , async ( ) => {
138+ const { result, options } = renderActions ( {
139+ activeThreadId : "thread-active" ,
140+ reviewDeliveryMode : "inline" ,
141+ } ) ;
142+
143+ await act ( async ( ) => {
144+ await result . current . runPullRequestReview ( { intent : "full" } ) ;
145+ } ) ;
146+
147+ expect ( options . startThreadForWorkspace ) . not . toHaveBeenCalled ( ) ;
148+ expect ( options . sendUserMessageToThread ) . toHaveBeenCalledWith (
149+ workspace ,
150+ "thread-active" ,
151+ expect . any ( String ) ,
152+ [ ] ,
153+ ) ;
154+ } ) ;
134155} ) ;
0 commit comments