Skip to content

Commit 94059ca

Browse files
committed
fix tests
1 parent 045ccc5 commit 94059ca

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/nextjs/test/config/withSentry.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ describe('withSentry', () => {
9696
});
9797

9898
it('flushes events before finishing non-erroring response', async () => {
99+
jest
100+
.spyOn(hub.Hub.prototype, 'getClient')
101+
.mockReturnValueOnce({ getOptions: () => ({ tracesSampleRate: 1 } as ClientOptions) } as Client);
102+
99103
await callWrappedHandler(wrappedHandlerNoError, req, res);
100104

101105
expect(flushSpy).toHaveBeenCalled();

packages/nextjs/test/config/wrappers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('data-fetching function wrappers', () => {
2424
describe('starts a transaction and puts request in metadata if tracing enabled', () => {
2525
beforeEach(() => {
2626
req = { headers: {}, url: 'http://dogs.are.great/tricks/kangaroo' } as IncomingMessage;
27-
res = {} as ServerResponse;
27+
res = { end: jest.fn() } as unknown as ServerResponse;
2828

2929
jest.spyOn(SentryTracing, 'hasTracingEnabled').mockReturnValueOnce(true);
3030
});

0 commit comments

Comments
 (0)