Skip to content

Commit e791ff4

Browse files
committed
add test
1 parent eb8ed5f commit e791ff4

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

packages/replay-internal/src/replay.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ export class ReplayContainer implements ReplayContainerInterface {
387387
// increases replay size)
388388
this._options._experiments.continuousCheckout && {
389389
// Minimum checkout time is 6 minutes
390-
checkoutEveryNms: Math.min(360_000, this._options._experiments.continuousCheckout),
390+
checkoutEveryNms: Math.max(360_000, this._options._experiments.continuousCheckout),
391391
}),
392392
emit: getHandleRecordingEmit(this),
393393
onMutation: this._onMutationHandler,
@@ -400,8 +400,6 @@ export class ReplayContainer implements ReplayContainerInterface {
400400
}
401401
: {}),
402402
});
403-
404-
console.log('continuousCheckout', this._options._experiments);
405403
} catch (err) {
406404
this._handleException(err);
407405
}

packages/replay-internal/test/integration/rrweb.test.ts

+40
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,44 @@ describe('Integration | rrweb', () => {
4646
}
4747
`);
4848
});
49+
50+
it('calls rrweb.record with checkoutEveryNms', async () => {
51+
const { mockRecord } = await resetSdkMock({
52+
replayOptions: {
53+
_experiments: {
54+
continuousCheckout: 1,
55+
},
56+
},
57+
sentryOptions: {
58+
replaysOnErrorSampleRate: 0.0,
59+
replaysSessionSampleRate: 1.0,
60+
},
61+
});
62+
63+
expect(mockRecord.mock.calls[0]?.[0]).toMatchInlineSnapshot(`
64+
{
65+
"blockSelector": ".sentry-block,[data-sentry-block],base[href="/"],img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]",
66+
"checkoutEveryNms": 360000,
67+
"collectFonts": true,
68+
"emit": [Function],
69+
"errorHandler": [Function],
70+
"ignoreSelector": ".sentry-ignore,[data-sentry-ignore],input[type="file"]",
71+
"inlineImages": false,
72+
"inlineStylesheet": true,
73+
"maskAllInputs": true,
74+
"maskAllText": true,
75+
"maskAttributeFn": [Function],
76+
"maskInputFn": undefined,
77+
"maskInputOptions": {
78+
"password": true,
79+
},
80+
"maskTextFn": undefined,
81+
"maskTextSelector": ".sentry-mask,[data-sentry-mask]",
82+
"onMutation": [Function],
83+
"slimDOMOptions": "all",
84+
"unblockSelector": "",
85+
"unmaskTextSelector": "",
86+
}
87+
`);
88+
});
4989
});

0 commit comments

Comments
 (0)