Skip to content

Commit 0a0faa3

Browse files
committed
make tests safer
1 parent 1f8f34c commit 0a0faa3

File tree

1 file changed

+10
-7
lines changed
  • dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage

1 file changed

+10
-7
lines changed

dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,18 @@ sentryTest('should report finished spans as children of the root transaction', a
3030

3131
const span_1 = transaction.spans?.[0];
3232

33-
expect(span_1?.op).toBe('span_1');
34-
expect(span_1?.parent_span_id).toEqual(rootSpanId);
35-
expect(span_1?.data).toMatchObject({ foo: 'bar', baz: [1, 2, 3] });
33+
expect(span_1).toBeDefined();
34+
expect(span_1!.op).toBe('span_1');
35+
expect(span_1!.parent_span_id).toEqual(rootSpanId);
36+
expect(span_1!.data).toMatchObject({ foo: 'bar', baz: [1, 2, 3] });
3637

3738
const span_3 = transaction.spans?.[1];
38-
expect(span_3?.op).toBe('span_3');
39-
expect(span_3?.parent_span_id).toEqual(rootSpanId);
39+
expect(span_3).toBeDefined();
40+
expect(span_3!.op).toBe('span_3');
41+
expect(span_3!.parent_span_id).toEqual(rootSpanId);
4042

4143
const span_5 = transaction.spans?.[2];
42-
expect(span_5?.op).toBe('span_5');
43-
expect(span_5?.parent_span_id).toEqual(span_3?.span_id);
44+
expect(span_5).toBeDefined();
45+
expect(span_5!.op).toBe('span_5');
46+
expect(span_5!.parent_span_id).toEqual(span_3!.span_id);
4447
});

0 commit comments

Comments
 (0)