Skip to content

Commit 2ab84b6

Browse files
committed
fix tests
1 parent d9f8022 commit 2ab84b6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/replay-internal/test/unit/session/fetchSession.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('Unit | session | fetchSession', () => {
2828
);
2929

3030
expect(fetchSession()).toEqual({
31+
dirty: false,
3132
id: 'fd09adfc4117477abc8de643e5a5798a',
3233
lastActivity: 1648827162658,
3334
segmentId: 0,
@@ -39,10 +40,11 @@ describe('Unit | session | fetchSession', () => {
3940
it('fetches an unsampled session', function () {
4041
WINDOW.sessionStorage.setItem(
4142
REPLAY_SESSION_KEY,
42-
'{"id":"fd09adfc4117477abc8de643e5a5798a","sampled": false,"started":1648827162630,"lastActivity":1648827162658}',
43+
'{"id":"fd09adfc4117477abc8de643e5a5798a","sampled": false,"started":1648827162630,"lastActivity":1648827162658,"dirty":true}',
4344
);
4445

4546
expect(fetchSession()).toEqual({
47+
dirty: true,
4648
id: 'fd09adfc4117477abc8de643e5a5798a',
4749
lastActivity: 1648827162658,
4850
segmentId: 0,

packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ describe('Unit | session | loadOrCreateSession', () => {
7777
lastActivity: expect.any(Number),
7878
sampled: 'session',
7979
started: expect.any(Number),
80+
dirty: false,
8081
});
8182

8283
// Should not have anything in storage
@@ -104,6 +105,7 @@ describe('Unit | session | loadOrCreateSession', () => {
104105
lastActivity: expect.any(Number),
105106
sampled: 'session',
106107
started: expect.any(Number),
108+
dirty: false,
107109
});
108110

109111
// Should not have anything in storage
@@ -129,10 +131,10 @@ describe('Unit | session | loadOrCreateSession', () => {
129131
sampled: 'session',
130132
started: expect.any(Number),
131133
previousSessionId: 'previous_session_id',
134+
dirty: false,
132135
});
133136
});
134137
});
135-
136138
describe('stickySession: true', () => {
137139
it('creates new session if none exists', function () {
138140
const session = loadOrCreateSession(
@@ -151,6 +153,7 @@ describe('Unit | session | loadOrCreateSession', () => {
151153
lastActivity: expect.any(Number),
152154
sampled: 'session',
153155
started: expect.any(Number),
156+
dirty: false,
154157
};
155158
expect(session).toEqual(expectedSession);
156159

@@ -181,6 +184,7 @@ describe('Unit | session | loadOrCreateSession', () => {
181184
sampled: 'session',
182185
started: expect.any(Number),
183186
previousSessionId: 'test_old_session_uuid',
187+
dirty: false,
184188
};
185189
expect(session).toEqual(expectedSession);
186190
expect(session.lastActivity).toBeGreaterThanOrEqual(now);
@@ -209,6 +213,7 @@ describe('Unit | session | loadOrCreateSession', () => {
209213
lastActivity: date,
210214
sampled: 'session',
211215
started: date,
216+
dirty: false,
212217
});
213218
});
214219

@@ -250,6 +255,7 @@ describe('Unit | session | loadOrCreateSession', () => {
250255
sampled: 'session',
251256
started: expect.any(Number),
252257
previousSessionId: 'previous_session_id',
258+
dirty: false,
253259
};
254260
expect(session).toEqual(expectedSession);
255261

@@ -347,6 +353,7 @@ describe('Unit | session | loadOrCreateSession', () => {
347353
segmentId: 0,
348354
lastActivity: expect.any(Number),
349355
sampled: false,
356+
dirty: false,
350357
started: expect.any(Number),
351358
};
352359
expect(session).toEqual(expectedSession);

0 commit comments

Comments
 (0)