Skip to content

Commit b930e03

Browse files
committed
adjust tests
1 parent 8da73ac commit b930e03

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
@@ -342,12 +342,12 @@ export class Scope {
342342
}
343343

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

0 commit comments

Comments
 (0)