import XCTest
@testable import HealthProbe

final class LocalDeviceProfileTests: XCTestCase {
    override func tearDown() {
        LocalDeviceProfileStore.removeAll()
        super.tearDown()
    }

    func testSavesAndLoadsDeviceProfile() {
        let profile = LocalDeviceProfile(deviceID: "device-a", name: "Test Phone", colorTag: "green")

        LocalDeviceProfileStore.save(profile)

        let loaded = LocalDeviceProfileStore.profile(for: "device-a")
        XCTAssertEqual(loaded, profile)
    }

    func testEmptyDeviceIDIsNotPersisted() {
        LocalDeviceProfileStore.save(LocalDeviceProfile(deviceID: "", name: "Ignored", colorTag: "red"))

        XCTAssertTrue(LocalDeviceProfileStore.allProfiles().isEmpty)
    }
}
