-
Notifications
You must be signed in to change notification settings - Fork 25
/
inspector.test.ts
31 lines (29 loc) · 918 Bytes
/
inspector.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { BadRequestException, HttpException, HttpStatus } from '@nestjs/common';
import { RavenInterceptor } from '../lib/raven.interceptor';
describe('RavenInterceptor', () => {
describe('shouldReport', () => {
it('is not settings yet', () => {
const instance = new RavenInterceptor();
expect(instance['shouldReport'](new Error())).toBeTruthy();
});
it.each([
[
new HttpException(
`BAD REQUEST ${HttpStatus.BAD_REQUEST}`,
HttpStatus.BAD_REQUEST,
),
new BadRequestException(),
],
])('is not settings yet %s', (exception) => {
const instance = new RavenInterceptor({
filters: [
{
type: HttpException,
filter: (exception: HttpException) => 500 > exception.getStatus(),
},
],
});
expect(instance['shouldReport'](exception)).toBeFalsy();
});
});
});