'How to write unit test with jest for function that run command with spawn module And it has no return?

For example I have function like this:

const interfaceAddAddress = (tag, ip) => { 

  spawn('bash', ['-c', `ip addr add ${ip} dev ${tag}`]);

};

How to writ unit test with jest for it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source