-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to align `Span` & `Transaction` for usage in new performance APIs, this add `name` to the `Span` that also always returns a string.
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Span } from '../../../src'; | ||
|
||
describe('span', () => { | ||
it('works with name', () => { | ||
const span = new Span({ name: 'span name' }); | ||
expect(span.name).toEqual('span name'); | ||
expect(span.description).toEqual('span name'); | ||
}); | ||
|
||
it('works with description', () => { | ||
const span = new Span({ description: 'span name' }); | ||
expect(span.name).toEqual('span name'); | ||
expect(span.description).toEqual('span name'); | ||
}); | ||
|
||
it('works without name', () => { | ||
const span = new Span({}); | ||
expect(span.name).toEqual(''); | ||
expect(span.description).toEqual(undefined); | ||
}); | ||
|
||
it('allows to update the name', () => { | ||
const span = new Span({ name: 'span name' }); | ||
expect(span.name).toEqual('span name'); | ||
expect(span.description).toEqual('span name'); | ||
|
||
span.name = 'new name'; | ||
|
||
expect(span.name).toEqual('new name'); | ||
expect(span.description).toEqual('new name'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Transaction } from '../../../src'; | ||
|
||
describe('transaction', () => { | ||
it('works with name', () => { | ||
const transaction = new Transaction({ name: 'span name' }); | ||
expect(transaction.name).toEqual('span name'); | ||
}); | ||
|
||
it('allows to update the name', () => { | ||
const transaction = new Transaction({ name: 'span name' }); | ||
expect(transaction.name).toEqual('span name'); | ||
|
||
transaction.name = 'new name'; | ||
|
||
expect(transaction.name).toEqual('new name'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters