From 441a30121ed080dfcf62933a43bf3ce5b5cf8769 Mon Sep 17 00:00:00 2001 From: Abinet Date: Wed, 13 Mar 2024 15:15:01 -0700 Subject: [PATCH] add removed test --- .../test/utils.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts index 442611ae6b7..b70061e489d 100644 --- a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts +++ b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts @@ -192,6 +192,27 @@ describe('utils', () => { assert.strictEqual(addEventSpy.callCount, 0); }); }); + describe('when entries does NOT contain the performance', () => { + it('should NOT add event to span', () => { + const addEventSpy = sinon.spy(); + const span = { + addEvent: addEventSpy, + } as unknown as tracing.Span; + const entries = { + [PTN.FETCH_START]: 123, + } as PerformanceEntries; + + assert.strictEqual(addEventSpy.callCount, 0); + + addSpanNetworkEvent(span, 'foo', entries); + + assert.strictEqual( + addEventSpy.callCount, + 0, + 'should not call addEvent' + ); + }); + }); describe('when entries contain invalid performance timing', () => { it('should only add events with time greater that or equal to reference value to span', () => { const addEventSpy = sinon.spy();