HealthProbe / HealthProbeTests / LocalDeviceProfileTests.swift
Newer Older
24 lines | 0.74kb
Bogdan Timofte authored 2 weeks ago
1
import XCTest
2
@testable import HealthProbe
3

            
4
final class LocalDeviceProfileTests: XCTestCase {
5
    override func tearDown() {
6
        LocalDeviceProfileStore.removeAll()
7
        super.tearDown()
8
    }
9

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

            
13
        LocalDeviceProfileStore.save(profile)
14

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

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

            
22
        XCTAssertTrue(LocalDeviceProfileStore.allProfiles().isEmpty)
23
    }
24
}