@@ -48,7 +48,7 @@ final class RNSentryReplayOptions: XCTestCase {
4848 }
4949
5050 func assertAllDefaultReplayOptionsAreNotNil( replayOptions: [ String : Any ] ) {
51- XCTAssertEqual ( replayOptions. count, 8 )
51+ XCTAssertEqual ( replayOptions. count, 9 )
5252 XCTAssertNotNil ( replayOptions [ " sessionSampleRate " ] )
5353 XCTAssertNotNil ( replayOptions [ " errorSampleRate " ] )
5454 XCTAssertNotNil ( replayOptions [ " maskAllImages " ] )
@@ -57,6 +57,7 @@ final class RNSentryReplayOptions: XCTestCase {
5757 XCTAssertNotNil ( replayOptions [ " sdkInfo " ] )
5858 XCTAssertNotNil ( replayOptions [ " enableViewRendererV2 " ] )
5959 XCTAssertNotNil ( replayOptions [ " enableFastViewRendering " ] )
60+ XCTAssertNotNil ( replayOptions [ " quality " ] )
6061 }
6162
6263 func testSessionSampleRate( ) {
@@ -248,5 +249,73 @@ final class RNSentryReplayOptions: XCTestCase {
248249
249250 XCTAssertFalse ( actualOptions. sessionReplay. enableFastViewRendering)
250251 }
252+
253+ func testReplayQualityDefault( ) {
254+ let optionsDict = ( [
255+ " dsn " : " https://abc@def.ingest.sentry.io/1234567 " ,
256+ " replaysOnErrorSampleRate " : 0.75
257+ ] as NSDictionary ) . mutableCopy ( ) as! NSMutableDictionary
258+
259+ RNSentryReplay . updateOptions ( optionsDict)
260+
261+ let actualOptions = try ! Options ( dict: optionsDict as! [ String : Any ] )
262+
263+ XCTAssertEqual ( actualOptions. sessionReplay. quality, SentryReplayOptions . SentryReplayQuality. medium)
264+ }
251265
266+ func testReplayQualityLow( ) {
267+ let optionsDict = ( [
268+ " dsn " : " https://abc@def.ingest.sentry.io/1234567 " ,
269+ " replaysOnErrorSampleRate " : 0.75 ,
270+ " replaysSessionQuality " : " low "
271+ ] as NSDictionary ) . mutableCopy ( ) as! NSMutableDictionary
272+
273+ RNSentryReplay . updateOptions ( optionsDict)
274+
275+ let actualOptions = try ! Options ( dict: optionsDict as! [ String : Any ] )
276+
277+ XCTAssertEqual ( actualOptions. sessionReplay. quality, SentryReplayOptions . SentryReplayQuality. low)
278+ }
279+
280+ func testReplayQualityMedium( ) {
281+ let optionsDict = ( [
282+ " dsn " : " https://abc@def.ingest.sentry.io/1234567 " ,
283+ " replaysOnErrorSampleRate " : 0.75 ,
284+ " replaysSessionQuality " : " medium "
285+ ] as NSDictionary ) . mutableCopy ( ) as! NSMutableDictionary
286+
287+ RNSentryReplay . updateOptions ( optionsDict)
288+
289+ let actualOptions = try ! Options ( dict: optionsDict as! [ String : Any ] )
290+
291+ XCTAssertEqual ( actualOptions. sessionReplay. quality, SentryReplayOptions . SentryReplayQuality. medium)
292+ }
293+
294+ func testReplayQualityHigh( ) {
295+ let optionsDict = ( [
296+ " dsn " : " https://abc@def.ingest.sentry.io/1234567 " ,
297+ " replaysOnErrorSampleRate " : 0.75 ,
298+ " replaysSessionQuality " : " high "
299+ ] as NSDictionary ) . mutableCopy ( ) as! NSMutableDictionary
300+
301+ RNSentryReplay . updateOptions ( optionsDict)
302+
303+ let actualOptions = try ! Options ( dict: optionsDict as! [ String : Any ] )
304+
305+ XCTAssertEqual ( actualOptions. sessionReplay. quality, SentryReplayOptions . SentryReplayQuality. high)
306+ }
307+
308+ func testReplayQualityInvalidFallsBackToMedium( ) {
309+ let optionsDict = ( [
310+ " dsn " : " https://abc@def.ingest.sentry.io/1234567 " ,
311+ " replaysOnErrorSampleRate " : 0.75 ,
312+ " replaysSessionQuality " : " invalid "
313+ ] as NSDictionary ) . mutableCopy ( ) as! NSMutableDictionary
314+
315+ RNSentryReplay . updateOptions ( optionsDict)
316+
317+ let actualOptions = try ! Options ( dict: optionsDict as! [ String : Any ] )
318+
319+ XCTAssertEqual ( actualOptions. sessionReplay. quality, SentryReplayOptions . SentryReplayQuality. medium)
320+ }
252321}
0 commit comments