@@ -204,6 +204,75 @@ describe('API Integration Tests', () => {
204204 res . body . length . should . equal ( countBefore + 1 )
205205 } )
206206
207+ it ( 'should call getAudits with incorrect participantObjectID ' , async ( ) => {
208+ let filters = {
209+ 'participantObjectIdentification.participantObjectID' :
210+ '"!1234\\\\^\\\\^\\\\^.*&.*&.*"'
211+ }
212+ filters = JSON . stringify ( filters )
213+ const res = await request ( BASE_URL )
214+ . get (
215+ `/audits?filterPage=0&filterLimit=10&filters=${ encodeURIComponent (
216+ filters
217+ ) } `
218+ )
219+ . set ( 'auth-username' , testUtils . rootUser . email )
220+ . set ( 'auth-ts' , authDetails . authTS )
221+ . set ( 'auth-salt' , authDetails . authSalt )
222+ . set ( 'auth-token' , authDetails . authToken )
223+ . expect ( 400 )
224+
225+ res . statusCode . should . be . exactly ( 400 )
226+ } )
227+
228+ it ( 'should call getAudits with correct participantObjectID ($and) ' , async ( ) => {
229+ let filters = {
230+ 'participantObjectIdentification.participantObjectID' : {
231+ type : 'AND' ,
232+ patientID : '"1234\\\\^\\\\^\\\\^.*&.*&.*"' ,
233+ objectID : '123'
234+ }
235+ }
236+ filters = JSON . stringify ( filters )
237+ const res = await request ( BASE_URL )
238+ . get (
239+ `/audits?filterPage=0&filterLimit=10&filters=${ encodeURIComponent (
240+ filters
241+ ) } `
242+ )
243+ . set ( 'auth-username' , testUtils . rootUser . email )
244+ . set ( 'auth-ts' , authDetails . authTS )
245+ . set ( 'auth-salt' , authDetails . authSalt )
246+ . set ( 'auth-token' , authDetails . authToken )
247+ . expect ( 200 )
248+
249+ res . statusCode . should . be . exactly ( 200 )
250+ } )
251+
252+ it ( 'should call getAudits with incorrect participantObjectID ($and) ' , async ( ) => {
253+ let filters = {
254+ 'participantObjectIdentification.participantObjectID' : {
255+ type : 'AND' ,
256+ patientID : '"!1234\\\\^\\\\^\\\\^.*&.*&.*"' ,
257+ objectID : '123'
258+ }
259+ }
260+ filters = JSON . stringify ( filters )
261+ const res = await request ( BASE_URL )
262+ . get (
263+ `/audits?filterPage=0&filterLimit=10&filters=${ encodeURIComponent (
264+ filters
265+ ) } `
266+ )
267+ . set ( 'auth-username' , testUtils . rootUser . email )
268+ . set ( 'auth-ts' , authDetails . authTS )
269+ . set ( 'auth-salt' , authDetails . authSalt )
270+ . set ( 'auth-token' , authDetails . authToken )
271+ . expect ( 400 )
272+
273+ res . statusCode . should . be . exactly ( 400 )
274+ } )
275+
207276 it ( "should generate an 'audit log used' audit when using non-basic representation" , async ( ) => {
208277 const result = await new AuditModel ( auditData ) . save ( )
209278
0 commit comments