@@ -184,15 +184,27 @@ describe('Review Object Controller Integration Tests', () => {
184184 } )
185185
186186 it ( 'Retrieves review history with conversations included' , async ( ) => {
187+ // 1. Post a conversation message to the organization target UUID
188+ const msgRes = await chai
189+ . request ( app )
190+ . post ( `/api/conversation/target/${ orgUUID } ` )
191+ . set ( { ...constants . headers } )
192+ . send ( { body : 'Test comment on org history' , visibility : 'public' } )
193+ expect ( msgRes ) . to . have . status ( 200 )
194+
195+ // 2. Fetch the review history with conversations included
187196 const res = await chai
188197 . request ( app )
189198 . get ( `/api/review/org/${ constants . testRegistryOrg2 . short_name } /reviews?include_conversations=true` )
190199 . set ( { ...constants . headers } )
191200 expect ( res ) . to . have . status ( 200 )
192201 expect ( res . body ) . to . have . property ( 'reviewObjects' )
193- if ( res . body . reviewObjects . length > 0 ) {
194- expect ( res . body . reviewObjects [ 0 ] ) . to . have . property ( 'conversation' )
195- }
202+ expect ( res . body . reviewObjects ) . to . be . an ( 'array' )
203+ expect ( res . body . reviewObjects . length ) . to . be . greaterThan ( 0 )
204+ expect ( res . body . reviewObjects [ 0 ] ) . to . have . property ( 'conversation' )
205+ expect ( res . body . reviewObjects [ 0 ] . conversation ) . to . be . an ( 'array' )
206+ expect ( res . body . reviewObjects [ 0 ] . conversation . length ) . to . be . greaterThan ( 0 )
207+ expect ( res . body . reviewObjects [ 0 ] . conversation [ 0 ] ) . to . have . property ( 'body' , 'Test comment on org history' )
196208 } )
197209
198210 it ( 'Nonsecretariat user can update an organization, review object gets created' , async ( ) => {
0 commit comments