|
|
|
@ -110,12 +110,20 @@ describe('Commands', () => { |
|
|
|
|
|
|
|
// Test run command with default options
|
|
|
|
obj.run(commName, options); |
|
|
|
expect(command.run).toHaveBeenCalledWith(em, { ...options, ...defaultOptions }); |
|
|
|
expect(command.run).toHaveBeenCalledWith( |
|
|
|
expect.anything(), |
|
|
|
expect.objectContaining(options), |
|
|
|
expect.objectContaining(defaultOptions), |
|
|
|
); |
|
|
|
|
|
|
|
// Test run command without default options
|
|
|
|
em.config.commands.defaultOptions![commName].run = undefined; |
|
|
|
obj.run(commName, options); |
|
|
|
expect(command.run).toHaveBeenCalledWith(em, options); |
|
|
|
expect(command.run).toHaveBeenCalledWith( |
|
|
|
expect.anything(), |
|
|
|
expect.objectContaining(options), |
|
|
|
expect.not.objectContaining(defaultOptions), |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Stop command with and without default options', () => { |
|
|
|
@ -134,12 +142,20 @@ describe('Commands', () => { |
|
|
|
// Test stop command with default options
|
|
|
|
obj.run(commName, options); |
|
|
|
obj.stop(commName, options); |
|
|
|
expect(command.stop).toHaveBeenCalledWith(em, { ...options, ...defaultOptions }); |
|
|
|
expect(command.stop).toHaveBeenCalledWith( |
|
|
|
em, |
|
|
|
expect.objectContaining(options), |
|
|
|
expect.objectContaining(defaultOptions), |
|
|
|
); |
|
|
|
|
|
|
|
// Test stop command without default options
|
|
|
|
em.config.commands.defaultOptions![commName].stop = undefined; |
|
|
|
obj.stop(commName, options); |
|
|
|
expect(command.stop).toHaveBeenCalledWith(em, options); |
|
|
|
expect(command.stop).toHaveBeenCalledWith( |
|
|
|
em, |
|
|
|
expect.objectContaining(options), |
|
|
|
expect.not.objectContaining(defaultOptions), |
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|