Skip to content

Commit e0b310a

Browse files
committed
fix tests
1 parent d20b5bb commit e0b310a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/serverless/test/awslambda.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ describe('AWSLambda', () => {
9595
});
9696

9797
test('captureTimeoutWarning enabled (default)', async () => {
98-
expect.assertions(2);
99-
10098
const handler: Handler = (_event, _context, callback) => {
10199
setTimeout(() => {
102100
callback(null, 42);
@@ -105,14 +103,13 @@ describe('AWSLambda', () => {
105103
const wrappedHandler = wrapHandler(handler);
106104
await wrappedHandler(fakeEvent, fakeContext, fakeCallback);
107105

106+
expect(Sentry.withScope).toBeCalledTimes(2);
108107
expect(Sentry.captureMessage).toBeCalled();
109108
// @ts-expect-error see "Why @ts-expect-error" note
110109
expect(SentryNode.fakeScope.setTag).toBeCalledWith('timeout', '1s');
111110
});
112111

113112
test('captureTimeoutWarning disabled', async () => {
114-
expect.assertions(2);
115-
116113
const handler: Handler = (_event, _context, callback) => {
117114
setTimeout(() => {
118115
callback(null, 42);
@@ -123,8 +120,10 @@ describe('AWSLambda', () => {
123120
});
124121
await wrappedHandler(fakeEvent, fakeContext, fakeCallback);
125122

126-
expect(Sentry.withScope).not.toBeCalled();
123+
expect(Sentry.withScope).toBeCalledTimes(1);
127124
expect(Sentry.captureMessage).not.toBeCalled();
125+
// @ts-expect-error see "Why @ts-expect-error" note
126+
expect(SentryNode.fakeScope.setTag).not.toBeCalledWith('timeout', '1s');
128127
});
129128

130129
test('captureTimeoutWarning with configured timeoutWarningLimit', async () => {

0 commit comments

Comments
 (0)