File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
packages/replay-internal/test/integration Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @vitest -environment jsdom
3+ */
4+
5+ import { beforeEach , describe , expect , test } from 'vitest' ;
6+ import type { Replay } from '../../src/integration' ;
7+ import type { ReplayContainer } from '../../src/replay' ;
8+ import { resetSdkMock } from '../mocks/resetSdkMock' ;
9+ import { useFakeTimers } from '../utils/use-fake-timers' ;
10+
11+ useFakeTimers ( ) ;
12+
13+ describe ( 'Integration | getRecordingMode()' , ( ) => {
14+ let replay : ReplayContainer ;
15+ let integration : Replay ;
16+
17+ beforeEach ( async ( ) => {
18+ ( { replay, integration } = await resetSdkMock ( {
19+ replayOptions : {
20+ stickySession : false ,
21+ } ,
22+ sentryOptions : {
23+ replaysSessionSampleRate : 1.0 ,
24+ } ,
25+ } ) ) ;
26+ } ) ;
27+
28+ test ( 'returns "session" when session sampling is enabled' , async ( ) => {
29+ expect ( integration . getRecordingMode ( ) ) . toBe ( 'session' ) ;
30+ } ) ;
31+
32+ test ( 'returns "buffer" when buffering is enabled' , async ( ) => {
33+ replay . stop ( ) ;
34+ replay . startBuffering ( ) ;
35+ expect ( integration . getRecordingMode ( ) ) . toBe ( 'buffer' ) ;
36+ } ) ;
37+
38+ test ( 'returns undefined when replay is stopped' , async ( ) => {
39+ replay . stop ( ) ;
40+ expect ( integration . getRecordingMode ( ) ) . toBeUndefined ( ) ;
41+ } ) ;
42+ } ) ;
You can’t perform that action at this time.
0 commit comments