New source: - ByteLystPlatform.swift — unified entry point wiring all services (config, client, telemetry, flags, killSwitch, crashReporter, keychain, auditLog, auth) - BLKeychainAccessor — convenience wrapper binding BLKeychain to a bundleId - start(userId:) / stop() lifecycle for telemetry + flags + killSwitch New tests (5 files, ~25 test cases): - ByteLystPlatformTests — init, start/stop, idempotency, keychain accessor - BLPlatformConfigTests — default + custom init - BLKillSwitchClientTests — default state, reset - BLFeatureFlagClientTests — empty flags, unknown key, stop - BLTelemetryClientTests — installId stability, session rotation, track/flush Also: add .build/ and .swiftpm/ to .gitignore
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
import XCTest
|
|
@testable import ByteLystPlatformSDK
|
|
|
|
final class BLPlatformConfigTests: XCTestCase {
|
|
|
|
func testInitWithDefaults() {
|
|
let config = BLPlatformConfig(
|
|
productId: "testapp",
|
|
baseURL: "http://localhost:4003",
|
|
bundleId: "com.bytelyst.testapp"
|
|
)
|
|
XCTAssertEqual(config.productId, "testapp")
|
|
XCTAssertEqual(config.baseURL, "http://localhost:4003")
|
|
XCTAssertEqual(config.platform, "ios")
|
|
XCTAssertEqual(config.channel, "native")
|
|
XCTAssertEqual(config.bundleId, "com.bytelyst.testapp")
|
|
XCTAssertNil(config.appGroupId)
|
|
}
|
|
|
|
func testInitWithCustomValues() {
|
|
let config = BLPlatformConfig(
|
|
productId: "peakpulse",
|
|
baseURL: "https://api.peakpulse.app",
|
|
platform: "watchos",
|
|
channel: "companion",
|
|
bundleId: "com.saravana.peakpulse",
|
|
appGroupId: "group.com.saravana.peakpulse"
|
|
)
|
|
XCTAssertEqual(config.productId, "peakpulse")
|
|
XCTAssertEqual(config.platform, "watchos")
|
|
XCTAssertEqual(config.channel, "companion")
|
|
XCTAssertEqual(config.appGroupId, "group.com.saravana.peakpulse")
|
|
}
|
|
}
|