Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Jul 26, 2024
1 parent 9185d3b commit e19f4fc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/replay-internal/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export class ReplayContainer implements ReplayContainerInterface {
// increases replay size)
this._options._experiments.continuousCheckout && {
// Minimum checkout time is 6 minutes
checkoutEveryNms: Math.min(360_000, this._options._experiments.continuousCheckout),
checkoutEveryNms: Math.max(360_000, this._options._experiments.continuousCheckout),
}),
emit: getHandleRecordingEmit(this),
onMutation: this._onMutationHandler,
Expand All @@ -400,8 +400,6 @@ export class ReplayContainer implements ReplayContainerInterface {
}
: {}),
});

console.log('continuousCheckout', this._options._experiments);
} catch (err) {
this._handleException(err);
}
Expand Down
40 changes: 40 additions & 0 deletions packages/replay-internal/test/integration/rrweb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,44 @@ describe('Integration | rrweb', () => {
}
`);
});

it('calls rrweb.record with checkoutEveryNms', async () => {
const { mockRecord } = await resetSdkMock({
replayOptions: {
_experiments: {
continuousCheckout: 1,
},
},
sentryOptions: {
replaysOnErrorSampleRate: 0.0,
replaysSessionSampleRate: 1.0,
},
});

expect(mockRecord.mock.calls[0]?.[0]).toMatchInlineSnapshot(`
{
"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"]",
"checkoutEveryNms": 360000,
"collectFonts": true,
"emit": [Function],
"errorHandler": [Function],
"ignoreSelector": ".sentry-ignore,[data-sentry-ignore],input[type="file"]",
"inlineImages": false,
"inlineStylesheet": true,
"maskAllInputs": true,
"maskAllText": true,
"maskAttributeFn": [Function],
"maskInputFn": undefined,
"maskInputOptions": {
"password": true,
},
"maskTextFn": undefined,
"maskTextSelector": ".sentry-mask,[data-sentry-mask]",
"onMutation": [Function],
"slimDOMOptions": "all",
"unblockSelector": "",
"unmaskTextSelector": "",
}
`);
});
});

0 comments on commit e19f4fc

Please sign in to comment.