Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('null or undefined input', async () => {
const context = {
operation: 'someOperation',
action: 'someAction',
};
await failureLogger(context)();
expect(logger.warn.mock.calls).toHaveLength(1);
expect(logger.warn.mock.calls[0][0]).toMatchSnapshot();
});
const extendedSystemError = nError({
status: 500,
message: 'some error message',
});
await failureLogger()(extendedSystemError);
expect(logger.error.mock.calls).toHaveLength(1);
assertErrorLog(logger.error.mock.calls[0][0]);
const extendedSystemError404 = nError({
status: 404,
message: 'some error message',
});
await failureLogger()(extendedSystemError404);
expect(logger.error.mock.calls).toHaveLength(1);
expect(logger.warn.mock.calls).toHaveLength(1);
assertErrorLog(logger.warn.mock.calls[0][0]);
});