diff --git a/src/__tests__/extensions/replay/sessionrecording.test.ts b/src/__tests__/extensions/replay/sessionrecording.test.ts index c866290c1..480f545ec 100644 --- a/src/__tests__/extensions/replay/sessionrecording.test.ts +++ b/src/__tests__/extensions/replay/sessionrecording.test.ts @@ -1982,21 +1982,26 @@ describe('SessionRecording', () => { }) sessionRecording = new SessionRecording(posthog) + expect(sessionRecording['queuedRRWebEvents']).toHaveLength(0) + sessionRecording.onRemoteConfig(makeDecideResponse({ sessionRecording: { endpoint: '/s/' } })) - sessionRecording.startIfEnabledOrStop() - expect(loadScriptMock).toHaveBeenCalled() - expect(sessionRecording['queuedRRWebEvents']).toHaveLength(0) + expect(sessionRecording['queuedRRWebEvents']).toHaveLength(1) - sessionRecording['_tryAddCustomEvent']('test', { test: 'test' }) + sessionRecording.startIfEnabledOrStop() + expect(loadScriptMock).toHaveBeenCalled() }) it('queues events', () => { - expect(sessionRecording['queuedRRWebEvents']).toHaveLength(1) + sessionRecording['_tryAddCustomEvent']('test', { test: 'test' }) + + expect(sessionRecording['queuedRRWebEvents']).toHaveLength(2) }) it('limits the queue of events', () => { - expect(sessionRecording['queuedRRWebEvents']).toHaveLength(1) + sessionRecording['_tryAddCustomEvent']('test', { test: 'test' }) + + expect(sessionRecording['queuedRRWebEvents']).toHaveLength(2) for (let i = 0; i < 100; i++) { sessionRecording['_tryAddCustomEvent']('test', { test: 'test' })