Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuravi committed Jul 12, 2024
1 parent 2d9fdb5 commit 4ea7ff4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Tests/HealthKitOnFHIRTests/HKQuantitySampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2409,6 +2409,36 @@ class HKQuantitySampleTests: XCTestCase {
)
}

func testWalkingSpeed() throws {
let observation = try createObservationFrom(
type: HKQuantityType(.walkingSpeed),
quantity: HKQuantity(unit: HKUnit.meter().unitDivided(by: HKUnit.second()), doubleValue: 1.5)
)

XCTAssertEqual(
observation.code.coding,
[
createCoding(
code: "HKQuantityTypeIdentifierWalkingSpeed",
display: "Walking Speed",
system: .apple
)
]
)

XCTAssertEqual(
observation.value,
.quantity(
Quantity(
code: "m.s-1",
system: "http://unitsofmeasure.org".asFHIRURIPrimitive(),
unit: "m/s",
value: 1.5.asFHIRDecimalPrimitive()
)
)
)
}

func testDistanceCycling() throws {
let observation = try createObservationFrom(
type: HKQuantityType(.distanceCycling),
Expand Down

0 comments on commit 4ea7ff4

Please sign in to comment.