Skip to content

Commit 62926d1

Browse files
committed
add scope tests
1 parent 3ce0dd9 commit 62926d1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/hub/test/scope.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ describe('Scope', () => {
129129
expect((scope as any)._span).toEqual(undefined);
130130
});
131131

132+
test('setProcessingMetadata', () => {
133+
const scope = new Scope();
134+
scope.setProcessingMetadata({ dogs: 'are great!' });
135+
expect((scope as any)._processingMetadata.dogs).toEqual('are great!');
136+
});
137+
132138
test('chaining', () => {
133139
const scope = new Scope();
134140
scope.setLevel(Severity.Critical).setUser({ id: '1' });
@@ -189,7 +195,8 @@ describe('Scope', () => {
189195

190196
describe('applyToEvent', () => {
191197
test('basic usage', () => {
192-
expect.assertions(8);
198+
expect.assertions(9);
199+
193200
const scope = new Scope();
194201
scope.setExtra('a', 2);
195202
scope.setTag('a', 'b');
@@ -199,6 +206,8 @@ describe('Scope', () => {
199206
scope.setTransactionName('/abc');
200207
scope.addBreadcrumb({ message: 'test' });
201208
scope.setContext('os', { id: '1' });
209+
scope.setProcessingMetadata({ dogs: 'are great!' });
210+
202211
const event: Event = {};
203212
return scope.applyToEvent(event).then(processedEvent => {
204213
expect(processedEvent!.extra).toEqual({ a: 2 });
@@ -209,6 +218,7 @@ describe('Scope', () => {
209218
expect(processedEvent!.transaction).toEqual('/abc');
210219
expect(processedEvent!.breadcrumbs![0]).toHaveProperty('message', 'test');
211220
expect(processedEvent!.contexts).toEqual({ os: { id: '1' } });
221+
expect(processedEvent!.processingMetadata).toEqual({ dogs: 'are great!' });
212222
});
213223
});
214224

0 commit comments

Comments
 (0)