Skip to content

Commit

Permalink
fix various typos
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Oct 26, 2022
1 parent 9ad4a5f commit d86d9c3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions Sources/Sentry/SentryCoreDataTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ - (NSString *)descriptionForOperations:
__block NSMutableArray *resultParts = [NSMutableArray new];

void (^operationInfo)(NSUInteger, NSString *) = ^void(NSUInteger total, NSString *op) {
NSDictionary *itens = operations[op];
if (itens && itens.count > 0) {
if (itens.count == 1) {
NSDictionary *items = operations[op];
if (items && items.count > 0) {
if (items.count == 1) {
[resultParts addObject:[NSString stringWithFormat:@"%@ %@ '%@'", op,
itens.allValues[0], itens.allKeys[0]]];
items.allValues[0], items.allKeys[0]]];
} else {
[resultParts addObject:[NSString stringWithFormat:@"%@ %lu items", op,
(unsigned long)total]];
Expand Down
40 changes: 20 additions & 20 deletions Tests/SentryTests/Helper/SentrySwizzleWrapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest

extension SentrySwizzleWrapper {

static func hasItens() -> Bool {
static func hasItems() -> Bool {
guard let result = Dynamic(self).hasCallbacks as Bool? else {
return false
}
Expand Down Expand Up @@ -42,70 +42,70 @@ class SentrySwizzleWrapperTests: XCTestCase {
}

func testSendAction_RegisterCallbacks_CallbacksCalled() {
let firstExcpectation = expectation(description: "first")
let firstExpectation = expectation(description: "first")
sut.swizzleSendAction({ actualAction, _, _, actualEvent in
XCTAssertEqual(self.fixture.actionName, actualAction)
XCTAssertEqual(self.fixture.event, actualEvent)
firstExcpectation.fulfill()
firstExpectation.fulfill()
}, forKey: "first")

let secondExcpectation = expectation(description: "second")
let secondExpectation = expectation(description: "second")
sut.swizzleSendAction({ actualAction, _, _, actualEvent in
XCTAssertEqual(self.fixture.actionName, actualAction)
XCTAssertEqual(self.fixture.event, actualEvent)
secondExcpectation.fulfill()
secondExpectation.fulfill()
}, forKey: "second")

sendActionCalled()

wait(for: [firstExcpectation, secondExcpectation], timeout: 0.1)
wait(for: [firstExpectation, secondExpectation], timeout: 0.1)
}

func testSendAction_RegisterCallbackForSameKey_LastCallbackCalled() {
let firstExcpectation = expectation(description: "first")
firstExcpectation.isInverted = true
let firstExpectation = expectation(description: "first")
firstExpectation.isInverted = true
sut.swizzleSendAction({ _, _, _, _ in
firstExcpectation.fulfill()
firstExpectation.fulfill()
}, forKey: "first")

let secondExcpectation = expectation(description: "second")
let secondExpectation = expectation(description: "second")
sut.swizzleSendAction({ actualAction, _, _, actualEvent in
XCTAssertEqual(self.fixture.actionName, actualAction)
XCTAssertEqual(self.fixture.event, actualEvent)
secondExcpectation.fulfill()
secondExpectation.fulfill()
}, forKey: "first")

sendActionCalled()

wait(for: [firstExcpectation, secondExcpectation], timeout: 0.1)
wait(for: [firstExpectation, secondExpectation], timeout: 0.1)
}

func testSendAction_RemoveCallback_CallbackNotCalled() {
let firstExcpectation = expectation(description: "first")
firstExcpectation.isInverted = true
let firstExpectation = expectation(description: "first")
firstExpectation.isInverted = true
sut.swizzleSendAction({ _, _, _, _ in
firstExcpectation.fulfill()
firstExpectation.fulfill()
}, forKey: "first")

sut.removeSwizzleSendAction(forKey: "first")

sendActionCalled()

wait(for: [firstExcpectation], timeout: 0.1)
wait(for: [firstExpectation], timeout: 0.1)
}

func testSendAction_AfterCallingReset_CallbackNotCalled() {
let neverExcpectation = expectation(description: "never")
neverExcpectation.isInverted = true
let neverExpectation = expectation(description: "never")
neverExpectation.isInverted = true
sut.swizzleSendAction({ _, _, _, _ in
neverExcpectation.fulfill()
neverExpectation.fulfill()
}, forKey: "never")

sut.removeAllCallbacks()

sendActionCalled()

wait(for: [neverExcpectation], timeout: 0.1)
wait(for: [neverExpectation], timeout: 0.1)
}

private func sendActionCalled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,50 +32,50 @@ class SentryUIEventTrackerIntegrationTests: XCTestCase {
clearTestState()
}

func test_noInstallion_SwizzlingDisabled() {
func test_noInstallation_SwizzlingDisabled() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking(enableSwizzling: false))
assertNoInstallation(sut)
XCTAssertFalse(SentrySwizzleWrapper.hasItens())
XCTAssertFalse(SentrySwizzleWrapper.hasItems())
}

func test_noInstallation_AutoPerformanceDisabled() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking(enableAutoPerformanceTracking: false))
assertNoInstallation(sut)
XCTAssertFalse(SentrySwizzleWrapper.hasItens())
XCTAssertFalse(SentrySwizzleWrapper.hasItems())
}

func test_noInstallation_UserInterationDisabled() {
func test_noInstallation_UserInteractionDisabled() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking(enableUserInteractionTracing: false))
assertNoInstallation(sut)
XCTAssertFalse(SentrySwizzleWrapper.hasItens())
XCTAssertFalse(SentrySwizzleWrapper.hasItems())
}

func test_noInstallation_NoSampleRate() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking(tracesSampleRate: 0))
assertNoInstallation(sut)
XCTAssertFalse(SentrySwizzleWrapper.hasItens())
XCTAssertFalse(SentrySwizzleWrapper.hasItems())
}

func test_Installation() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking())
XCTAssertNotNil(Dynamic(sut).uiEventTracker as SentryUIEventTracker?)
XCTAssertTrue(SentrySwizzleWrapper.hasItens())
XCTAssertTrue(SentrySwizzleWrapper.hasItems())
}

func test_Uninstall() {
let sut = fixture.getSut()
sut.install(with: fixture.optionForUIEventTracking())
XCTAssertNotNil(Dynamic(sut).uiEventTracker as SentryUIEventTracker?)
XCTAssertTrue(SentrySwizzleWrapper.hasItens())
XCTAssertTrue(SentrySwizzleWrapper.hasItems())

sut.uninstall()

XCTAssertFalse(SentrySwizzleWrapper.hasItens())
XCTAssertFalse(SentrySwizzleWrapper.hasItems())
}

func assertNoInstallation(_ integration: SentryUIEventTrackingIntegration) {
Expand Down

0 comments on commit d86d9c3

Please sign in to comment.