@@ -27,6 +27,8 @@ describe('Messages tests', function () {
2727 subjectAttachment : 'Search Query Attachment Marker' ,
2828 body : 'searchquerybodytoken' ,
2929 attachmentBody : 'searchqueryattachmenttoken' ,
30+ multiTerm1 : 'searchquerymultiterm1token' ,
31+ multiTerm2 : 'searchquerymultiterm2token' ,
3032 toAddress : 'search.query.to@to.com' ,
3133 ccAddress : 'search.query.cc@to.com' ,
3234 fromAddress : 'messagestestsuser@web.zone.test'
@@ -89,7 +91,7 @@ describe('Messages tests', function () {
8991 cc : [ { address : queryFixture . ccAddress } ] ,
9092 bcc : [ { address : queryFixture . ccAddress } ] ,
9193 subject : queryFixture . subjectKeyword ,
92- text : `${ queryFixture . body } keyword marker`
94+ text : `${ queryFixture . body } keyword marker ${ queryFixture . multiTerm1 } ${ queryFixture . multiTerm2 } `
9395 } )
9496 . expect ( 200 ) ;
9597
@@ -262,6 +264,27 @@ describe('Messages tests', function () {
262264 expect ( search . body . results . map ( entry => entry . subject ) ) . to . include ( queryFixture . subjectExcluded ) ;
263265 } ) ;
264266
267+ it ( 'should GET /users/:user/search expect success / q with two terms and searchable=1' , async ( ) => {
268+ const q = `${ queryFixture . multiTerm1 } ${ queryFixture . multiTerm2 } in:${ queryMailbox } ` ;
269+
270+ const search = await server
271+ . get ( `/users/${ user } /search?q=${ encodeURIComponent ( q ) } &limit=50` )
272+ . send ( { } )
273+ . expect ( 200 ) ;
274+
275+ const searchWithSearchable = await server
276+ . get ( `/users/${ user } /search?q=${ encodeURIComponent ( q ) } &searchable=1&limit=50` )
277+ . send ( { } )
278+ . expect ( 200 ) ;
279+
280+ expect ( search . body . success ) . to . be . true ;
281+ expect ( searchWithSearchable . body . success ) . to . be . true ;
282+ expect ( searchWithSearchable . body . query ) . to . equal ( q ) ;
283+ expect ( search . body . results . map ( entry => entry . subject ) ) . to . include ( queryFixture . subjectKeyword ) ;
284+ expect ( searchWithSearchable . body . results . map ( entry => entry . subject ) ) . to . include ( queryFixture . subjectKeyword ) ;
285+ expect ( searchWithSearchable . body . results ) . to . deep . equal ( search . body . results ) ;
286+ } ) ;
287+
265288 it ( 'should GET /users/:user/search expect success / q supports OR groups' , async ( ) => {
266289 const q = `(${ queryFixture . body } OR ${ queryFixture . attachmentBody } ) in:${ queryMailbox } ` ;
267290 const search = await server
0 commit comments