Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('should log an error message if something went wrong', () => {
const throwError = true;
jsonfile.setup(throwError);
sut.writeFile('../test', {});
expect(chalk.red).toHaveBeenCalled();
});
test('should log a success message if everything went well', () => {
jsonfile.setup(false);
sut.writeFile('../test', {});
expect(chalk.green).toHaveBeenCalledWith(
'Order successfully written to file'
);
});
});