mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
29 lines
1002 B
TypeScript
29 lines
1002 B
TypeScript
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
import { logger } from '@test/testSetup'
|
|
|
|
import LogError from './LogError'
|
|
|
|
describe('LogError', () => {
|
|
it('logs an Error when created', () => {
|
|
/* eslint-disable-next-line no-new */
|
|
new LogError('new LogError')
|
|
expect(logger.error).toBeCalledWith('new LogError')
|
|
})
|
|
|
|
it('logs an Error including additional data when created', () => {
|
|
/* eslint-disable-next-line no-new */
|
|
new LogError('new LogError', { some: 'data' })
|
|
expect(logger.error).toBeCalledWith('new LogError', { some: 'data' })
|
|
})
|
|
|
|
it('does not contain additional data in Error object when thrown', () => {
|
|
try {
|
|
throw new LogError('new LogError', { someWeirdValue123: 'arbitraryData456' })
|
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
} catch (e: any) {
|
|
expect(e.stack).not.toMatch(/(someWeirdValue123|arbitraryData456)/i)
|
|
}
|
|
})
|
|
})
|