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
28 lines
788 B
Swift
28 lines
788 B
Swift
import XCTest
|
|
@testable import ByteLystPlatformSDK
|
|
|
|
final class BLKillSwitchClientTests: XCTestCase {
|
|
|
|
private func makeConfig() -> BLPlatformConfig {
|
|
BLPlatformConfig(
|
|
productId: "testapp",
|
|
baseURL: "http://localhost:4003",
|
|
bundleId: "com.bytelyst.test"
|
|
)
|
|
}
|
|
|
|
func testDefaultState() {
|
|
let client = BLKillSwitchClient(config: makeConfig())
|
|
XCTAssertFalse(client.isDisabled)
|
|
XCTAssertEqual(client.maintenanceMessage, "")
|
|
}
|
|
|
|
func testReset() {
|
|
let client = BLKillSwitchClient(config: makeConfig())
|
|
// Manually test reset clears any hypothetical state
|
|
client.reset()
|
|
XCTAssertFalse(client.isDisabled)
|
|
XCTAssertEqual(client.maintenanceMessage, "")
|
|
}
|
|
}
|