Skip to content

Commit

Permalink
test(test): add should report spec
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Oct 2, 2023
1 parent e4a5327 commit 3ed43d1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/inspector.test.ts
@@ -0,0 +1,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();
});
});
});

0 comments on commit 3ed43d1

Please sign in to comment.