@@ -96,9 +96,9 @@ describe('openInLibreSignAction rules', () => {
9696 order : number
9797 displayName : unknown
9898 iconSvgInline : unknown
99- enabled : ( context : { nodes : unknown } ) => boolean
100- exec : ( context : { nodes : unknown } ) => Promise < unknown >
101- execBatch : ( context : { nodes : unknown } ) => Promise < unknown >
99+ enabled : ( nodes : unknown [ ] ) => boolean
100+ exec : ( node : unknown , view ? : unknown , dir ?: unknown ) => Promise < unknown >
101+ execBatch : ( nodes : unknown [ ] , view ? : unknown , dir ?: unknown ) => Promise < unknown [ ] >
102102 }
103103 let loadState : { mockReturnValue : ( value : unknown ) => unknown }
104104 let getCapabilities : { mockReturnValue : ( value : unknown ) => unknown }
@@ -146,19 +146,15 @@ describe('openInLibreSignAction rules', () => {
146146 it ( 'disables action when certificate not configured' , ( ) => {
147147 loadState . mockReturnValue ( false )
148148
149- const enabled = action . enabled ( {
150- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
151- } )
149+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
152150
153151 expect ( enabled ) . toBe ( false )
154152 } )
155153
156154 it ( 'enables action when certificate configured' , ( ) => {
157155 loadState . mockReturnValue ( true )
158156
159- const enabled = action . enabled ( {
160- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
161- } )
157+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
162158
163159 expect ( enabled ) . toBe ( true )
164160 } )
@@ -170,47 +166,37 @@ describe('openInLibreSignAction rules', () => {
170166 } )
171167
172168 it ( 'enables for single PDF file' , ( ) => {
173- const enabled = action . enabled ( {
174- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
175- } )
169+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
176170
177171 expect ( enabled ) . toBe ( true )
178172 } )
179173
180174 it ( 'disables for single non-PDF file' , ( ) => {
181- const enabled = action . enabled ( {
182- nodes : [ { type : 'file' , mime : 'image/png' } ] ,
183- } )
175+ const enabled = action . enabled ( [ { type : 'file' , mime : 'image/png' } ] )
184176
185177 expect ( enabled ) . toBe ( false )
186178 } )
187179
188180 it ( 'enables for single PDF when only mimetype is provided' , ( ) => {
189- const enabled = action . enabled ( {
190- nodes : [ { type : 'file' , mimetype : 'application/pdf' } ] ,
191- } )
181+ const enabled = action . enabled ( [ { type : 'file' , mimetype : 'application/pdf' } ] )
192182
193183 expect ( enabled ) . toBe ( true )
194184 } )
195185
196186 it ( 'enables for folder with signature status' , ( ) => {
197- const enabled = action . enabled ( {
198- nodes : [ {
199- type : 'folder' ,
200- attributes : { 'libresign-signature-status' : 'signed' } ,
201- } ] ,
202- } )
187+ const enabled = action . enabled ( [ {
188+ type : 'folder' ,
189+ attributes : { 'libresign-signature-status' : 'signed' } ,
190+ } ] )
203191
204192 expect ( enabled ) . toBe ( true )
205193 } )
206194
207195 it ( 'disables for folder without signature status' , ( ) => {
208- const enabled = action . enabled ( {
209- nodes : [ {
210- type : 'folder' ,
211- attributes : { } ,
212- } ] ,
213- } )
196+ const enabled = action . enabled ( [ {
197+ type : 'folder' ,
198+ attributes : { } ,
199+ } ] )
214200
215201 expect ( enabled ) . toBe ( false )
216202 } )
@@ -230,12 +216,10 @@ describe('openInLibreSignAction rules', () => {
230216 } ,
231217 } )
232218
233- const enabled = action . enabled ( {
234- nodes : [
235- { type : 'file' , mime : 'application/pdf' } ,
236- { type : 'file' , mime : 'application/pdf' } ,
237- ] ,
238- } )
219+ const enabled = action . enabled ( [
220+ { type : 'file' , mime : 'application/pdf' } ,
221+ { type : 'file' , mime : 'application/pdf' } ,
222+ ] )
239223
240224 expect ( enabled ) . toBe ( true )
241225 } )
@@ -249,12 +233,10 @@ describe('openInLibreSignAction rules', () => {
249233 } ,
250234 } )
251235
252- const enabled = action . enabled ( {
253- nodes : [
254- { type : 'file' , mime : 'application/pdf' } ,
255- { type : 'file' , mime : 'application/pdf' } ,
256- ] ,
257- } )
236+ const enabled = action . enabled ( [
237+ { type : 'file' , mime : 'application/pdf' } ,
238+ { type : 'file' , mime : 'application/pdf' } ,
239+ ] )
258240
259241 expect ( enabled ) . toBe ( false )
260242 } )
@@ -268,12 +250,10 @@ describe('openInLibreSignAction rules', () => {
268250 } ,
269251 } )
270252
271- const enabled = action . enabled ( {
272- nodes : [
273- { type : 'file' , mime : 'application/pdf' } ,
274- { type : 'file' , mime : 'image/png' } ,
275- ] ,
276- } )
253+ const enabled = action . enabled ( [
254+ { type : 'file' , mime : 'application/pdf' } ,
255+ { type : 'file' , mime : 'image/png' } ,
256+ ] )
277257
278258 expect ( enabled ) . toBe ( false )
279259 } )
@@ -286,7 +266,7 @@ describe('openInLibreSignAction rules', () => {
286266
287267 window . OCA = { Libresign : { } }
288268
289- await action . execBatch ( { nodes } )
269+ await action . execBatch ( nodes )
290270
291271 const pending = getPendingEnvelope ( )
292272 expect ( pending . files [ 0 ] . fileId ) . toBe ( 999 )
@@ -300,17 +280,17 @@ describe('openInLibreSignAction rules', () => {
300280 } )
301281
302282 it ( 'disables when nodes array is empty' , ( ) => {
303- const enabled = action . enabled ( { nodes : [ ] } )
283+ const enabled = action . enabled ( [ ] )
304284 expect ( enabled ) . toBe ( false )
305285 } )
306286
307287 it ( 'disables when nodes is null' , ( ) => {
308- const enabled = action . enabled ( { nodes : null } )
288+ const enabled = action . enabled ( null as unknown as unknown [ ] )
309289 expect ( enabled ) . toBe ( false )
310290 } )
311291
312292 it ( 'disables when nodes is undefined' , ( ) => {
313- const enabled = action . enabled ( { nodes : undefined } )
293+ const enabled = action . enabled ( undefined as unknown as unknown [ ] )
314294 expect ( enabled ) . toBe ( false )
315295 } )
316296 } )
@@ -323,7 +303,7 @@ describe('openInLibreSignAction rules', () => {
323303 it ( 'opens sidebar with file' , async ( ) => {
324304 const node = { type : 'file' , mime : 'application/pdf' , fileid : 123 }
325305
326- await action . exec ( { nodes : [ node ] } )
306+ await action . exec ( node )
327307
328308 expect ( mockSidebar . open ) . toHaveBeenCalledWith ( node , 'libresign' )
329309 expect ( mockSidebar . setActiveTab ) . toHaveBeenCalledWith ( 'libresign' )
@@ -336,14 +316,14 @@ describe('openInLibreSignAction rules', () => {
336316 fileid : 456 ,
337317 }
338318
339- await action . exec ( { nodes : [ node ] } )
319+ await action . exec ( node )
340320
341321 expect ( mockSidebar . open ) . toHaveBeenCalledWith ( node , 'libresign' )
342322 } )
343323
344324 it ( 'returns null after execution' , async ( ) => {
345325 const node = { type : 'file' , mime : 'application/pdf' }
346- const result = await action . exec ( { nodes : [ node ] } )
326+ const result = await action . exec ( node )
347327
348328 expect ( result ) . toBeNull ( )
349329 } )
@@ -392,7 +372,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
392372 { type : 'file' , mime : 'application/pdf' , fileid : 2 , dirname : '/Docs' } ,
393373 ]
394374
395- const result = await action . execBatch ( { nodes } )
375+ const result = await action . execBatch ( nodes )
396376
397377 expect ( result ) . toEqual ( [ null , null ] )
398378 } )
@@ -405,7 +385,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
405385
406386 window . OCA = { Libresign : { } }
407387
408- await action . execBatch ( { nodes } )
388+ await action . execBatch ( nodes )
409389
410390 expect ( mockSidebar . open ) . toHaveBeenCalled ( )
411391 expect ( mockSidebar . setActiveTab ) . toHaveBeenCalledWith ( 'libresign' )
@@ -419,7 +399,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
419399
420400 window . OCA = { Libresign : { } }
421401
422- await action . execBatch ( { nodes } )
402+ await action . execBatch ( nodes )
423403
424404 const pending = getPendingEnvelope ( )
425405 expect ( pending . nodeType ) . toBe ( 'envelope' )
@@ -436,7 +416,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
436416
437417 window . OCA = { Libresign : { } }
438418
439- await action . execBatch ( { nodes } )
419+ await action . execBatch ( nodes )
440420
441421 const pending = getPendingEnvelope ( )
442422 expect ( pending . settings . path ) . toBe ( '/Documents/Contracts/Test Envelope' )
@@ -450,7 +430,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
450430
451431 window . OCA = { Libresign : { } }
452432
453- await action . execBatch ( { nodes } )
433+ await action . execBatch ( nodes )
454434
455435 const pending = getPendingEnvelope ( )
456436 expect ( pending . settings . path ) . toBe ( '/Test Envelope' )
@@ -464,7 +444,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
464444
465445 window . OCA = { Libresign : { } }
466446
467- await action . execBatch ( { nodes } )
447+ await action . execBatch ( nodes )
468448
469449 const pending = getPendingEnvelope ( )
470450 expect ( pending . settings . path ) . toBe ( '/Docs/Test Envelope' )
@@ -490,7 +470,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
490470
491471 window . OCA = { Libresign : { } }
492472
493- await action . execBatch ( { nodes } )
473+ await action . execBatch ( nodes )
494474
495475 const pending = getPendingEnvelope ( )
496476 expect ( pending . files [ 0 ] . fileId ) . toBe ( 123 )
0 commit comments