Skip to content

Commit

Permalink
test: Add Scope maxBreadcrumb edge case tests (#3581)
Browse files Browse the repository at this point in the history
Add two test cases for edge cases when adding breadcrumbs.
  • Loading branch information
philipphofmann authored Jan 29, 2024
1 parent eef4553 commit 6129be5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/SentryTests/SentryScopeSwiftTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Nimble
import SentryTestUtils
import XCTest

Expand Down Expand Up @@ -303,6 +304,24 @@ class SentryScopeSwiftTests: XCTestCase {
wait(for: [expect], timeout: 0.1)
}

func testMaxBreadcrumbs_IsZero() {
let scope = Scope(maxBreadcrumbs: 0)

scope.addBreadcrumb(fixture.breadcrumb)

let serialized = scope.serialize()
expect(serialized["breadcrumbs"]) == nil
}

func testMaxBreadcrumbs_IsNegative() {
let scope = Scope(maxBreadcrumbs: Int.min)

scope.addBreadcrumb(fixture.breadcrumb)

let serialized = scope.serialize()
expect(serialized["breadcrumbs"]) == nil
}

func testUseSpanForClear() {
fixture.scope.span = fixture.transaction
fixture.scope.useSpan { (_) in
Expand Down

0 comments on commit 6129be5

Please sign in to comment.