Skip to content

Commit 2506702

Browse files
committed
add test
1 parent a5170a7 commit 2506702

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
});

0 commit comments

Comments
 (0)