Skip to content

Commit

Permalink
resolve more broken test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed May 29, 2024
1 parent 195c0d0 commit b918b56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

@testable import AWSCloudWatchLoggingPlugin

import Amplify
import XCTest

final class AWSCloudWatchLoggingPluginConfigurationTests: XCTestCase {
Expand Down Expand Up @@ -36,7 +36,7 @@ final class AWSCloudWatchLoggingPluginConfigurationTests: XCTestCase {
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.localStoreMaxSizeInMB, 5)
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.logGroupName, "testLogGroup")
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.region, "us-east-1")
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.loggingConstraints.defaultLogLevel.rawValue, 0)
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.loggingConstraints.defaultLogLevel.rawValue, LogLevel.error.rawValue)
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.loggingConstraints.categoryLogLevel?.count, 2)
XCTAssertEqual(config.awsCloudWatchLoggingPlugin.loggingConstraints.userLogLevel?.count, 1)
}
Expand All @@ -56,9 +56,9 @@ final class AWSCloudWatchLoggingPluginConfigurationTests: XCTestCase {
XCTFail("Unable to decode from data")
return
}
XCTAssertEqual(loggingConstraints.defaultLogLevel.rawValue, 0)
XCTAssertEqual(loggingConstraints.defaultLogLevel.rawValue, LogLevel.error.rawValue)
XCTAssertEqual(loggingConstraints.categoryLogLevel?.count, 4)
XCTAssertEqual(loggingConstraints.userLogLevel?.count, 2)
XCTAssertEqual(loggingConstraints.userLogLevel?["sub1"]?.defaultLogLevel.rawValue, 2)
XCTAssertEqual(loggingConstraints.userLogLevel?["sub1"]?.defaultLogLevel.rawValue, LogLevel.info.rawValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@testable import AWSCloudWatchLoggingPlugin

import XCTest
import Amplify

final class AWSCloudWatchLoggingPluginTests: XCTestCase {

Expand All @@ -33,16 +34,16 @@ final class AWSCloudWatchLoggingPluginTests: XCTestCase {
let configuration = AWSCloudWatchLoggingPluginConfiguration(logGroupName: "testLogGroup", region: "us-east-1")
let plugin = AWSCloudWatchLoggingPlugin(loggingPluginConfiguration: configuration)
var authLogger = plugin.logger(forCategory: "Auth")
XCTAssertEqual(authLogger.logLevel.rawValue, 0)
XCTAssertEqual(authLogger.logLevel.rawValue, LogLevel.error.rawValue)

authLogger = plugin.logger(forCategory: "Auth", forNamespace: "test")
XCTAssertEqual(authLogger.logLevel.rawValue, 0)
XCTAssertEqual(authLogger.logLevel.rawValue, LogLevel.error.rawValue)

let apiLogger = plugin.logger(forCategory: "API", logLevel: .debug)
XCTAssertEqual(apiLogger.logLevel.rawValue, 3)
XCTAssertEqual(apiLogger.logLevel.rawValue, LogLevel.debug.rawValue)

let defaultLogger = plugin.logger(forNamespace: "test")
XCTAssertEqual(defaultLogger.logLevel.rawValue, 0)
XCTAssertEqual(defaultLogger.logLevel.rawValue, LogLevel.error.rawValue)
}

/// Given: a AWSCloudWatchLoggingPlugin
Expand Down

0 comments on commit b918b56

Please sign in to comment.