Skip to content

Commit c50718e

Browse files
committed
adjust tests
1 parent 7870a37 commit c50718e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

packages/aws-serverless/test/sdk.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const mockScope = {
1818
setTag: jest.fn(),
1919
setContext: jest.fn(),
2020
addEventProcessor: jest.fn(),
21+
setTransactionName: jest.fn(),
2122
};
2223

2324
jest.mock('@sentry/node', () => {
@@ -81,12 +82,8 @@ const fakeCallback: Callback = (err, result) => {
8182
};
8283

8384
function expectScopeSettings() {
84-
expect(mockScope.addEventProcessor).toBeCalledTimes(1);
85-
// Test than an event processor to add `transaction` is registered for the scope
86-
const eventProcessor = mockScope.addEventProcessor.mock.calls[0][0];
87-
const event: Event = {};
88-
eventProcessor(event);
89-
expect(event).toEqual({ transaction: 'functionName' });
85+
expect(mockScope.setTransactionName).toBeCalledTimes(1);
86+
expect(mockScope.setTransactionName).toBeCalledWith('functionName');
9087

9188
expect(mockScope.setTag).toBeCalledWith('server_name', expect.anything());
9289

packages/core/src/scope.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ export class Scope {
341341
}
342342

343343
/**
344-
* Sets the transaction name on the scope so that the name of the transaction
345-
* (e.g. taken server route or page location) is attached to future events.
344+
* Sets the transaction name on the scope so that the name of e.g. taken server route or
345+
* the page location is attached to future events.
346346
*
347347
* IMPORTANT: Calling this function does NOT change the name of the currently active
348-
* span. If you want to change the name of the active span, use `span.updateName()`
349-
* instead.
348+
* root span. If you want to change the name of the active root span, use
349+
* `Sentry.updateSpanName(rootSpan, 'new name')` instead.
350350
*
351351
* By default, the SDK updates the scope's transaction name automatically on sensible
352352
* occasions, such as a page navigation or when handling a new request on the server.

0 commit comments

Comments
 (0)