NewPumpEventTests.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // NewPumpEventTests.swift
  3. // LoopKitTests
  4. //
  5. // Created by Darin Krauss on 1/13/22.
  6. // Copyright © 2022 LoopKit Authors. All rights reserved.
  7. //
  8. import XCTest
  9. import HealthKit
  10. @testable import LoopKit
  11. class NewPumpEventRawRepresentableTests: XCTestCase {
  12. func testNewPumpEventRawRepresentable() {
  13. let original = NewPumpEvent(date: Date(),
  14. dose: DoseEntry(type: .tempBasal,
  15. startDate: Date(),
  16. endDate: Date().addingTimeInterval(.minutes(30)),
  17. value: 1.5,
  18. unit: .unitsPerHour,
  19. deliveredUnits: 0.5,
  20. description: "Test Dose Entry",
  21. syncIdentifier: UUID().uuidString,
  22. scheduledBasalRate: HKQuantity(unit: .internationalUnitsPerHour, doubleValue: 2.0),
  23. insulinType: .fiasp,
  24. automatic: true,
  25. manuallyEntered: false,
  26. isMutable: true,
  27. wasProgrammedByPumpUI: true),
  28. raw: Data(UUID().uuidString.utf8),
  29. title: "Test Pump Event",
  30. type: .tempBasal,
  31. alarmType: .occlusion)
  32. let actual = NewPumpEvent(rawValue: original.rawValue)
  33. XCTAssertEqual(actual, original)
  34. }
  35. }