@@ -114,6 +114,64 @@ describe('MCP Application Tools', function () {
114114 } )
115115 } )
116116
117+ describe ( 'platform_export_application_audit_log' , function ( ) {
118+ const tool = findTool ( 'platform_export_application_audit_log' )
119+
120+ it ( 'has read-only annotations' , function ( ) {
121+ tool . annotations . readOnlyHint . should . equal ( true )
122+ tool . annotations . destructiveHint . should . equal ( false )
123+ } )
124+
125+ it ( 'exposes the expected input fields' , function ( ) {
126+ Object . keys ( tool . inputSchema ) . should . eql ( [ 'applicationId' , 'cursor' , 'limit' , 'query' , 'event' , 'username' , 'scope' , 'includeChildren' ] )
127+ } )
128+
129+ it ( 'requests the export endpoint with no query string when no filters are given' , async function ( ) {
130+ const { calls, inject } = recordingInject ( )
131+ await tool . handler ( { applicationId : 'app1' } , { inject } )
132+ calls . should . have . length ( 1 )
133+ calls [ 0 ] . method . should . equal ( 'GET' )
134+ calls [ 0 ] . url . should . equal ( '/api/v1/applications/app1/audit-log/export' )
135+ } )
136+
137+ it ( 'serialises cursor, limit, event, username, scope and includeChildren onto the query string' , async function ( ) {
138+ const { calls, inject } = recordingInject ( )
139+ await tool . handler ( {
140+ applicationId : 'app1' ,
141+ cursor : 'c1' ,
142+ limit : 10 ,
143+ event : 'application.created' ,
144+ username : 'alice' ,
145+ scope : 'application' ,
146+ includeChildren : true
147+ } , { inject } )
148+ calls . should . have . length ( 1 )
149+ calls [ 0 ] . method . should . equal ( 'GET' )
150+ calls [ 0 ] . url . should . equal ( '/api/v1/applications/app1/audit-log/export?cursor=c1&limit=10&event=application.created&username=alice&scope=application&includeChildren=true' )
151+ } )
152+ } )
153+
154+ describe ( 'platform_list_team_application_statuses' , function ( ) {
155+ const tool = findTool ( 'platform_list_team_application_statuses' )
156+
157+ it ( 'has the expected input params' , function ( ) {
158+ Object . keys ( tool . inputSchema ) . should . eql ( [ 'teamId' , 'associationsLimit' ] )
159+ } )
160+
161+ it ( 'calls GET /api/v1/teams/:teamId/applications/status with associationsLimit' , async function ( ) {
162+ const { calls, inject } = recordingInject ( )
163+ await tool . handler ( { teamId : 'team1' , associationsLimit : 5 } , { inject } )
164+ calls [ 0 ] . method . should . equal ( 'GET' )
165+ calls [ 0 ] . url . should . equal ( '/api/v1/teams/team1/applications/status?associationsLimit=5' )
166+ } )
167+
168+ it ( 'omits the query string when associationsLimit is not set' , async function ( ) {
169+ const { calls, inject } = recordingInject ( )
170+ await tool . handler ( { teamId : 'team1' } , { inject } )
171+ calls [ 0 ] . url . should . equal ( '/api/v1/teams/team1/applications/status' )
172+ } )
173+ } )
174+
117175 describe ( 'Integration smoke test' , function ( ) {
118176 let app
119177 let token
@@ -229,6 +287,23 @@ describe('MCP Application Tools', function () {
229287 url : `/api/v1/applications/${ app . application . hashid } /snapshots`
230288 } )
231289 } )
290+
291+ it ( 'platform_export_application_audit_log matches GET /api/v1/applications/:applicationId/audit-log/export' , async function ( ) {
292+ const tool = findTool ( 'platform_export_application_audit_log' )
293+ await expectToolMatchesRoute ( inject , tool , { applicationId : app . application . hashid } , {
294+ method : 'GET' ,
295+ url : `/api/v1/applications/${ app . application . hashid } /audit-log/export` ,
296+ raw : true
297+ } )
298+ } )
299+
300+ it ( 'platform_list_team_application_statuses matches GET /api/v1/teams/:teamId/applications/status' , async function ( ) {
301+ const tool = findTool ( 'platform_list_team_application_statuses' )
302+ await expectToolMatchesRoute ( inject , tool , { teamId : app . team . hashid } , {
303+ method : 'GET' ,
304+ url : `/api/v1/teams/${ app . team . hashid } /applications/status`
305+ } )
306+ } )
232307 } )
233308 } )
234309} )
0 commit comments