Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Jul 31, 2024
1 parent 67d831b commit dc702ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions Tests/TelemetryClientTests/LogHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
import XCTest

final class LogHandlerTests: XCTestCase {
var counter: Int = 0
var lastLevel: LogHandler.LogLevel?

func testLogHandler_stdoutLogLevelDefined() {
XCTAssertEqual(LogHandler.stdout(.error).logLevel, .error)
}

func testLogHandler_logLevelRespected() {
var counter = 0

let handler = LogHandler(logLevel: .info) { _, _ in
counter += 1
self.counter += 1
}

XCTAssertEqual(counter, 0)
Expand All @@ -23,10 +24,8 @@ final class LogHandlerTests: XCTestCase {
}

func testLogHandler_defaultLogLevel() {
var lastLevel: LogHandler.LogLevel?

let handler = LogHandler(logLevel: .debug) { level, _ in
lastLevel = level
self.lastLevel = level
}

handler.log(message: "")
Expand Down
10 changes: 5 additions & 5 deletions Tests/TelemetryClientTests/TelemetryClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ final class TelemetryClientTests: XCTestCase {
}
}

let configuration = TelemetryManagerConfiguration(appID: UUID().uuidString)
var configuration = TelemetryManagerConfiguration(appID: UUID().uuidString)
configuration.metadataEnrichers.append(BasicEnricher())

let signalManager = FakeSignalManager()
Expand All @@ -81,7 +81,7 @@ final class TelemetryClientTests: XCTestCase {
}
}

let configuration = TelemetryManagerConfiguration(appID: UUID().uuidString)
var configuration = TelemetryManagerConfiguration(appID: UUID().uuidString)
configuration.metadataEnrichers.append(BasicEnricher())

let signalManager = FakeSignalManager()
Expand Down Expand Up @@ -111,7 +111,7 @@ final class TelemetryClientTests: XCTestCase {
func testSendsSignals_withAnalyticsExplicitlyEnabled() {
let YOUR_APP_ID = "44e0f59a-60a2-4d4a-bf27-1f96ccb4aaa3"

let configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
var configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
configuration.analyticsDisabled = false

let signalManager = FakeSignalManager()
Expand All @@ -125,7 +125,7 @@ final class TelemetryClientTests: XCTestCase {
func testDoesNotSendSignals_withAnalyticsExplicitlyDisabled() {
let YOUR_APP_ID = "44e0f59a-60a2-4d4a-bf27-1f96ccb4aaa3"

let configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
var configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
configuration.analyticsDisabled = true

let signalManager = FakeSignalManager()
Expand All @@ -141,7 +141,7 @@ final class TelemetryClientTests: XCTestCase {

let YOUR_APP_ID = "44e0f59a-60a2-4d4a-bf27-1f96ccb4aaa3"

let configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
var configuration = TelemetryManagerConfiguration(appID: YOUR_APP_ID)
configuration.analyticsDisabled = false

let signalManager = FakeSignalManager()
Expand Down

0 comments on commit dc702ae

Please sign in to comment.