@@ -95,9 +95,9 @@ describe('openInLibreSignAction rules', () => {
9595 order : number
9696 displayName : unknown
9797 iconSvgInline : unknown
98- enabled : ( context : { nodes : unknown } ) => boolean
99- exec : ( context : { nodes : unknown } ) => Promise < unknown >
100- execBatch : ( context : { nodes : unknown } ) => Promise < unknown >
98+ enabled : ( nodes : unknown [ ] ) => boolean
99+ exec : ( node : unknown ) => Promise < unknown >
100+ execBatch : ( nodes : unknown [ ] ) => Promise < unknown >
101101 }
102102 let loadState : { mockReturnValue : ( value : unknown ) => unknown }
103103 let getCapabilities : { mockReturnValue : ( value : unknown ) => unknown }
@@ -151,19 +151,15 @@ describe('openInLibreSignAction rules', () => {
151151 it ( 'disables action when certificate not configured' , ( ) => {
152152 loadState . mockReturnValue ( false )
153153
154- const enabled = action . enabled ( {
155- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
156- } )
154+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
157155
158156 expect ( enabled ) . toBe ( false )
159157 } )
160158
161159 it ( 'enables action when certificate configured' , ( ) => {
162160 loadState . mockReturnValue ( true )
163161
164- const enabled = action . enabled ( {
165- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
166- } )
162+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
167163
168164 expect ( enabled ) . toBe ( true )
169165 } )
@@ -175,47 +171,37 @@ describe('openInLibreSignAction rules', () => {
175171 } )
176172
177173 it ( 'enables for single PDF file' , ( ) => {
178- const enabled = action . enabled ( {
179- nodes : [ { type : 'file' , mime : 'application/pdf' } ] ,
180- } )
174+ const enabled = action . enabled ( [ { type : 'file' , mime : 'application/pdf' } ] )
181175
182176 expect ( enabled ) . toBe ( true )
183177 } )
184178
185179 it ( 'disables for single non-PDF file' , ( ) => {
186- const enabled = action . enabled ( {
187- nodes : [ { type : 'file' , mime : 'image/png' } ] ,
188- } )
180+ const enabled = action . enabled ( [ { type : 'file' , mime : 'image/png' } ] )
189181
190182 expect ( enabled ) . toBe ( false )
191183 } )
192184
193185 it ( 'enables for single PDF when only mimetype is provided' , ( ) => {
194- const enabled = action . enabled ( {
195- nodes : [ { type : 'file' , mimetype : 'application/pdf' } ] ,
196- } )
186+ const enabled = action . enabled ( [ { type : 'file' , mimetype : 'application/pdf' } ] )
197187
198188 expect ( enabled ) . toBe ( true )
199189 } )
200190
201191 it ( 'enables for folder with signature status' , ( ) => {
202- const enabled = action . enabled ( {
203- nodes : [ {
204- type : 'folder' ,
205- attributes : { 'libresign-signature-status' : 'signed' } ,
206- } ] ,
207- } )
192+ const enabled = action . enabled ( [ {
193+ type : 'folder' ,
194+ attributes : { 'libresign-signature-status' : 'signed' } ,
195+ } ] )
208196
209197 expect ( enabled ) . toBe ( true )
210198 } )
211199
212200 it ( 'disables for folder without signature status' , ( ) => {
213- const enabled = action . enabled ( {
214- nodes : [ {
215- type : 'folder' ,
216- attributes : { } ,
217- } ] ,
218- } )
201+ const enabled = action . enabled ( [ {
202+ type : 'folder' ,
203+ attributes : { } ,
204+ } ] )
219205
220206 expect ( enabled ) . toBe ( false )
221207 } )
@@ -235,12 +221,10 @@ describe('openInLibreSignAction rules', () => {
235221 } ,
236222 } )
237223
238- const enabled = action . enabled ( {
239- nodes : [
240- { type : 'file' , mime : 'application/pdf' } ,
241- { type : 'file' , mime : 'application/pdf' } ,
242- ] ,
243- } )
224+ const enabled = action . enabled ( [
225+ { type : 'file' , mime : 'application/pdf' } ,
226+ { type : 'file' , mime : 'application/pdf' } ,
227+ ] )
244228
245229 expect ( enabled ) . toBe ( true )
246230 } )
@@ -254,12 +238,10 @@ describe('openInLibreSignAction rules', () => {
254238 } ,
255239 } )
256240
257- const enabled = action . enabled ( {
258- nodes : [
259- { type : 'file' , mime : 'application/pdf' } ,
260- { type : 'file' , mime : 'application/pdf' } ,
261- ] ,
262- } )
241+ const enabled = action . enabled ( [
242+ { type : 'file' , mime : 'application/pdf' } ,
243+ { type : 'file' , mime : 'application/pdf' } ,
244+ ] )
263245
264246 expect ( enabled ) . toBe ( false )
265247 } )
@@ -273,12 +255,10 @@ describe('openInLibreSignAction rules', () => {
273255 } ,
274256 } )
275257
276- const enabled = action . enabled ( {
277- nodes : [
278- { type : 'file' , mime : 'application/pdf' } ,
279- { type : 'file' , mime : 'image/png' } ,
280- ] ,
281- } )
258+ const enabled = action . enabled ( [
259+ { type : 'file' , mime : 'application/pdf' } ,
260+ { type : 'file' , mime : 'image/png' } ,
261+ ] )
282262
283263 expect ( enabled ) . toBe ( false )
284264 } )
@@ -291,7 +271,7 @@ describe('openInLibreSignAction rules', () => {
291271
292272 window . OCA . Libresign = { }
293273
294- await action . execBatch ( { nodes } )
274+ await action . execBatch ( nodes )
295275
296276 const pending = getPendingEnvelope ( )
297277 expect ( pending . files [ 0 ] . fileId ) . toBe ( 999 )
@@ -305,17 +285,19 @@ describe('openInLibreSignAction rules', () => {
305285 } )
306286
307287 it ( 'disables when nodes array is empty' , ( ) => {
308- const enabled = action . enabled ( { nodes : [ ] } )
288+ const enabled = action . enabled ( [ ] )
309289 expect ( enabled ) . toBe ( false )
310290 } )
311291
312292 it ( 'disables when nodes is null' , ( ) => {
313- const enabled = action . enabled ( { nodes : null } )
293+ // @ts -expect-error Testing invalid input
294+ const enabled = action . enabled ( null )
314295 expect ( enabled ) . toBe ( false )
315296 } )
316297
317298 it ( 'disables when nodes is undefined' , ( ) => {
318- const enabled = action . enabled ( { nodes : undefined } )
299+ // @ts -expect-error Testing invalid input
300+ const enabled = action . enabled ( undefined )
319301 expect ( enabled ) . toBe ( false )
320302 } )
321303 } )
@@ -328,7 +310,7 @@ describe('openInLibreSignAction rules', () => {
328310 it ( 'opens sidebar with file' , async ( ) => {
329311 const node = { type : 'file' , mime : 'application/pdf' , fileid : 123 , path : '/test.pdf' }
330312
331- await action . exec ( { nodes : [ node ] } )
313+ await action . exec ( node )
332314
333315 expect ( mockSidebar . open ) . toHaveBeenCalledWith ( '/test.pdf' )
334316 expect ( mockSidebar . setActiveTab ) . toHaveBeenCalledWith ( 'libresign' )
@@ -342,14 +324,14 @@ describe('openInLibreSignAction rules', () => {
342324 path : '/Documents' ,
343325 }
344326
345- await action . exec ( { nodes : [ node ] } )
327+ await action . exec ( node )
346328
347329 expect ( mockSidebar . open ) . toHaveBeenCalledWith ( '/Documents' )
348330 } )
349331
350332 it ( 'returns null after execution' , async ( ) => {
351333 const node = { type : 'file' , mime : 'application/pdf' , path : '/test.pdf' }
352- const result = await action . exec ( { nodes : [ node ] } )
334+ const result = await action . exec ( node )
353335
354336 expect ( result ) . toBeNull ( )
355337 } )
@@ -398,7 +380,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
398380 { type : 'file' , mime : 'application/pdf' , fileid : 2 , dirname : '/Docs' } ,
399381 ]
400382
401- const result = await action . execBatch ( { nodes } )
383+ const result = await action . execBatch ( nodes )
402384
403385 expect ( result ) . toEqual ( [ null , null ] )
404386 } )
@@ -411,7 +393,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
411393
412394 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
413395
414- await action . execBatch ( { nodes } )
396+ await action . execBatch ( nodes )
415397
416398 expect ( mockSidebar . open ) . toHaveBeenCalled ( )
417399 expect ( mockSidebar . setActiveTab ) . toHaveBeenCalledWith ( 'libresign' )
@@ -425,7 +407,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
425407
426408 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
427409
428- await action . execBatch ( { nodes } )
410+ await action . execBatch ( nodes )
429411
430412 const pending = getPendingEnvelope ( )
431413 expect ( pending . nodeType ) . toBe ( 'envelope' )
@@ -442,7 +424,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
442424
443425 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
444426
445- await action . execBatch ( { nodes } )
427+ await action . execBatch ( nodes )
446428
447429 const pending = getPendingEnvelope ( )
448430 expect ( pending . settings . path ) . toBe ( '/Documents/Contracts/Test Envelope' )
@@ -456,7 +438,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
456438
457439 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
458440
459- await action . execBatch ( { nodes } )
441+ await action . execBatch ( nodes )
460442
461443 const pending = getPendingEnvelope ( )
462444 expect ( pending . settings . path ) . toBe ( '/Test Envelope' )
@@ -470,7 +452,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
470452
471453 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
472454
473- await action . execBatch ( { nodes } )
455+ await action . execBatch ( nodes )
474456
475457 const pending = getPendingEnvelope ( )
476458 expect ( pending . settings . path ) . toBe ( '/Docs/Test Envelope' )
@@ -498,7 +480,7 @@ let spawnDialog: typeof import('@nextcloud/vue/functions/dialog').spawnDialog
498480
499481 window . OCA = { Libresign : { } , Files : { Sidebar : mockSidebar as OCAFilesSidebar } }
500482
501- await action . execBatch ( { nodes } )
483+ await action . execBatch ( nodes )
502484
503485 const pending = getPendingEnvelope ( )
504486 expect ( pending . files [ 0 ] . fileId ) . toBe ( 123 )
0 commit comments