@@ -8,7 +8,7 @@ import { ctx } from '../../src/events/context.js';
88
99vi . mock ( 'node:child_process' , async ( ) => {
1010 const { ChildProcess } = await import ( 'node:child_process' ) ;
11- const { default : EventEmitter } = await import ( 'node:events' ) ;
11+ const { EventEmitter } = await import ( 'node:events' ) ;
1212
1313 const process = new ChildProcess ( ) ;
1414 process . stdout = new EventEmitter ( ) as Readable ;
@@ -23,17 +23,17 @@ describe('Message sender tests', async () => {
2323 // Uses the child process from the mocks
2424 const mockChildProcess = fork ( '' ) ;
2525
26- const sudoRequestedSpy = vi . spyOn ( ctx , 'sudoRequested ' ) ;
26+ const commandRequestedSpy = vi . spyOn ( ctx , 'commandRequested ' ) ;
2727 const processSpy = vi . spyOn ( mockChildProcess , 'send' ) ;
2828
2929 const plugin = await PluginProcess . start ( '' , 'TestPlugin' , false ) ;
3030
31- mockChildProcess . emit ( 'message' , { cmd : MessageCmd . SUDO_REQUEST , data : { command : 'sudo something' } , requestId : 'requestId' } )
32- expect ( sudoRequestedSpy ) . toHaveBeenCalledOnce ( ) ;
31+ mockChildProcess . emit ( 'message' , { cmd : MessageCmd . COMMAND_REQUEST , data : { command : 'sudo something' , options : { requiresRoot : true } } , requestId : 'requestId' } )
32+ expect ( commandRequestedSpy ) . toHaveBeenCalledOnce ( ) ;
3333
34- ctx . commandRequestCompleted ( 'TestPlugin' , { status : SpawnStatus . SUCCESS , data : 'success' } )
34+ ctx . commandRequestCompleted ( 'TestPlugin' , { status : SpawnStatus . SUCCESS , data : 'success' , exitCode : 0 } )
3535 expect ( processSpy ) . to . be . lastCalledWith ( {
36- cmd : returnMessageCmd ( MessageCmd . SUDO_REQUEST ) ,
36+ cmd : returnMessageCmd ( MessageCmd . COMMAND_REQUEST ) ,
3737 requestId : 'requestId' ,
3838 data : expect . objectContaining ( {
3939 status : MessageStatus . SUCCESS ,
0 commit comments