Permalink
Browse files

test coverage

  • Loading branch information...
1 parent 3440614 commit f897ecd9e655de374fb617dffe1c971f97f6701e @mseemann committed Nov 3, 2015
Showing with 12 additions and 5 deletions.
  1. +11 −4 Example/Tests/HealthKitProfileReaderTest.swift
  2. +1 −1 Example/Tests/version-1.0.0.single-doc.json.hsg
@@ -27,7 +27,7 @@ class HealthKitProfileReaderTest: QuickSpec {
expect(profiles.count) == 1
expect(profiles[0].fileName) == "version-1.0.0.single-doc.json.hsg"
expect(profiles[0].fileSize) > 0
- expect(profiles[0].description) == "version-1.0.0.single-doc.json.hsg Optional(4046)"
+ expect(profiles[0].description) == "version-1.0.0.single-doc.json.hsg Optional(4491)"
}
it("should read the profile metadata"){
@@ -43,21 +43,28 @@ class HealthKitProfileReaderTest: QuickSpec {
}
}
- it("should import sample") {
+ it("should import samples") {
let profile = profiles[0]
var samples:[HKSample] = []
try! profile.importSamples(){
(sample: HKSample) in
samples.append(sample)
+ print(sample)
}
- expect(samples.count) == 5
+ expect(samples.count) == 8
let stepCount = samples[0] as! HKQuantitySample
expect(stepCount.sampleType.identifier) == "HKQuantityTypeIdentifierStepCount"
expect(stepCount.quantity.doubleValueForUnit(HKUnit(fromString: "count"))) == 200
+
+ let sleepSample = samples[2] as! HKCategorySample
+ expect(sleepSample.value) == 0
- let workout = samples[4] as! HKWorkout
+ let bloodPresure = samples[6] as! HKCorrelation
+ expect(bloodPresure.objects.count) == 2
+
+ let workout = samples[7] as! HKWorkout
expect(workout.workoutActivityType) == HKWorkoutActivityType.Running
}
@@ -1 +1 @@
-{"metaData":{"creationDate":1446486924969.067,"profileName":"output","version":"1.0.0","type":"JsonSingleDocExportTarget"},"userData":{"bloodType":1,"fitzpatrickSkinType":1,"biologicalSex":2,"dateOfBirth":341967600000},"HKQuantityTypeIdentifierDietaryManganese":[],"HKQuantityTypeIdentifierElectrodermalActivity":[],"HKQuantityTypeIdentifierDietaryMagnesium":[],"HKQuantityTypeIdentifierDietarySelenium":[],"HKQuantityTypeIdentifierBodyTemperature":[],"HKQuantityTypeIdentifierDietaryFatSaturated":[],"HKQuantityTypeIdentifierDietaryCopper":[],"HKQuantityTypeIdentifierDietaryPotassium":[],"HKQuantityTypeIdentifierDietaryVitaminK":[],"HKQuantityTypeIdentifierBodyFatPercentage":[],"HKQuantityTypeIdentifierDietaryCalcium":[],"HKQuantityTypeIdentifierDietaryIodine":[],"HKQuantityTypeIdentifierDietaryFatMonounsaturated":[],"HKQuantityTypeIdentifierDietaryPantothenicAcid":[],"HKQuantityTypeIdentifierDietaryThiamin":[],"HKQuantityTypeIdentifierStepCount":[{"unit":"count","sdate":1446486720000,"value":200}],"HKQuantityTypeIdentifierPeripheralPerfusionIndex":[],"HKQuantityTypeIdentifierDietaryFolate":[],"HKQuantityTypeIdentifierDietaryCholesterol":[],"HKQuantityTypeIdentifierDistanceWalkingRunning":[],"HKQuantityTypeIdentifierBasalEnergyBurned":[],"HKQuantityTypeIdentifierBodyMassIndex":[],"HKQuantityTypeIdentifierHeight":[],"HKQuantityTypeIdentifierDietaryWater":[],"HKQuantityTypeIdentifierHeartRate":[{"unit":"count/min","sdate":1446486720000,"value":61.99999999999999}],"HKQuantityTypeIdentifierDietaryVitaminB12":[],"HKQuantityTypeIdentifierPeakExpiratoryFlowRate":[],"HKQuantityTypeIdentifierBloodGlucose":[],"HKQuantityTypeIdentifierDietarySodium":[],"HKQuantityTypeIdentifierDietaryEnergyConsumed":[],"HKQuantityTypeIdentifierDistanceCycling":[],"HKQuantityTypeIdentifierDietaryRiboflavin":[],"HKQuantityTypeIdentifierBloodAlcoholContent":[],"HKQuantityTypeIdentifierDietaryZinc":[],"HKQuantityTypeIdentifierDietarySugar":[],"HKQuantityTypeIdentifierBloodPressureSystolic":[],"HKQuantityTypeIdentifierDietaryBiotin":[],"HKQuantityTypeIdentifierBloodPressureDiastolic":[],"HKQuantityTypeIdentifierLeanBodyMass":[],"HKQuantityTypeIdentifierDietaryNiacin":[],"HKQuantityTypeIdentifierDietaryChromium":[],"HKQuantityTypeIdentifierBasalBodyTemperature":[],"HKQuantityTypeIdentifierOxygenSaturation":[],"HKQuantityTypeIdentifierRespiratoryRate":[],"HKQuantityTypeIdentifierDietaryFiber":[],"HKQuantityTypeIdentifierDietaryCarbohydrates":[],"HKQuantityTypeIdentifierInhalerUsage":[],"HKQuantityTypeIdentifierDietaryIron":[],"HKQuantityTypeIdentifierDietaryMolybdenum":[],"HKQuantityTypeIdentifierDietaryProtein":[],"HKQuantityTypeIdentifierForcedExpiratoryVolume1":[],"HKQuantityTypeIdentifierDietaryPhosphorus":[],"HKQuantityTypeIdentifierDietaryFatPolyunsaturated":[],"HKQuantityTypeIdentifierNumberOfTimesFallen":[],"HKQuantityTypeIdentifierDietaryVitaminB6":[],"HKQuantityTypeIdentifierDietaryFatTotal":[],"HKQuantityTypeIdentifierDietaryChloride":[],"HKQuantityTypeIdentifierActiveEnergyBurned":[],"HKQuantityTypeIdentifierFlightsClimbed":[{"unit":"count","sdate":1446486600000,"value":1}],"HKQuantityTypeIdentifierForcedVitalCapacity":[],"HKQuantityTypeIdentifierBodyMass":[{"unit":"kg","sdate":1446486600000,"value":80}],"HKQuantityTypeIdentifierUVExposure":[],"HKQuantityTypeIdentifierDietaryVitaminA":[],"HKQuantityTypeIdentifierDietaryCaffeine":[],"HKQuantityTypeIdentifierDietaryVitaminC":[],"HKQuantityTypeIdentifierDietaryVitaminD":[],"HKQuantityTypeIdentifierDietaryVitaminE":[],"HKCategoryTypeIdentifierOvulationTestResult":[],"HKCategoryTypeIdentifierSleepAnalysis":[],"HKCategoryTypeIdentifierCervicalMucusQuality":[],"HKCategoryTypeIdentifierMenstrualFlow":[],"HKCategoryTypeIdentifierIntermenstrualBleeding":[],"HKCategoryTypeIdentifierSexualActivity":[],"HKCorrelationTypeIdentifierFood":[],"HKCorrelationTypeIdentifierBloodPressure":[],"HKWorkoutTypeIdentifier":[{"workoutActivityType":37,"totalEnergyBurned":90,"edate":1446486660000,"duration":840,"workoutEvents":[],"totalDistance":3218.688,"sdate":1446485820000}]}
+{"metaData":{"creationDate":1446486924969.067,"profileName":"output","version":"1.0.0","type":"JsonSingleDocExportTarget"},"userData":{"bloodType":1,"fitzpatrickSkinType":1,"biologicalSex":2,"dateOfBirth":341967600000},"HKQuantityTypeIdentifierDietaryManganese":[],"HKQuantityTypeIdentifierElectrodermalActivity":[],"HKQuantityTypeIdentifierDietaryMagnesium":[],"HKQuantityTypeIdentifierDietarySelenium":[],"HKQuantityTypeIdentifierBodyTemperature":[],"HKQuantityTypeIdentifierDietaryFatSaturated":[],"HKQuantityTypeIdentifierDietaryCopper":[],"HKQuantityTypeIdentifierDietaryPotassium":[],"HKQuantityTypeIdentifierDietaryVitaminK":[],"HKQuantityTypeIdentifierBodyFatPercentage":[],"HKQuantityTypeIdentifierDietaryCalcium":[],"HKQuantityTypeIdentifierDietaryIodine":[],"HKQuantityTypeIdentifierDietaryFatMonounsaturated":[],"HKQuantityTypeIdentifierDietaryPantothenicAcid":[],"HKQuantityTypeIdentifierDietaryThiamin":[],"HKQuantityTypeIdentifierStepCount":[{"unit":"count","sdate":1446486720000,"value":200}],"HKQuantityTypeIdentifierPeripheralPerfusionIndex":[],"HKQuantityTypeIdentifierDietaryFolate":[],"HKQuantityTypeIdentifierDietaryCholesterol":[],"HKQuantityTypeIdentifierDistanceWalkingRunning":[],"HKQuantityTypeIdentifierBasalEnergyBurned":[],"HKQuantityTypeIdentifierBodyMassIndex":[],"HKQuantityTypeIdentifierHeight":[],"HKQuantityTypeIdentifierDietaryWater":[],"HKQuantityTypeIdentifierHeartRate":[{"unit":"count/min","sdate":1446486720000,"value":61.99999999999999}],"HKQuantityTypeIdentifierDietaryVitaminB12":[],"HKQuantityTypeIdentifierPeakExpiratoryFlowRate":[],"HKQuantityTypeIdentifierBloodGlucose":[],"HKQuantityTypeIdentifierDietarySodium":[],"HKQuantityTypeIdentifierDietaryEnergyConsumed":[],"HKQuantityTypeIdentifierDistanceCycling":[],"HKQuantityTypeIdentifierDietaryRiboflavin":[],"HKQuantityTypeIdentifierBloodAlcoholContent":[],"HKQuantityTypeIdentifierDietaryZinc":[],"HKQuantityTypeIdentifierDietarySugar":[],"HKQuantityTypeIdentifierBloodPressureSystolic":[],"HKQuantityTypeIdentifierDietaryBiotin":[],"HKQuantityTypeIdentifierBloodPressureDiastolic":[],"HKQuantityTypeIdentifierLeanBodyMass":[],"HKQuantityTypeIdentifierDietaryNiacin":[],"HKQuantityTypeIdentifierDietaryChromium":[],"HKQuantityTypeIdentifierBasalBodyTemperature":[],"HKQuantityTypeIdentifierOxygenSaturation":[],"HKQuantityTypeIdentifierRespiratoryRate":[],"HKQuantityTypeIdentifierDietaryFiber":[],"HKQuantityTypeIdentifierDietaryCarbohydrates":[],"HKQuantityTypeIdentifierInhalerUsage":[],"HKQuantityTypeIdentifierDietaryIron":[],"HKQuantityTypeIdentifierDietaryMolybdenum":[],"HKQuantityTypeIdentifierDietaryProtein":[],"HKQuantityTypeIdentifierForcedExpiratoryVolume1":[],"HKQuantityTypeIdentifierDietaryPhosphorus":[],"HKQuantityTypeIdentifierDietaryFatPolyunsaturated":[],"HKQuantityTypeIdentifierNumberOfTimesFallen":[],"HKQuantityTypeIdentifierDietaryVitaminB6":[],"HKCategoryTypeIdentifierSleepAnalysis":[{"sdate":1446548580000,"edate":1446573780000,"value":0},{"sdate":1446480240000,"edate":1446573840000,"value":1}],"HKQuantityTypeIdentifierDietaryFatTotal":[],"HKQuantityTypeIdentifierDietaryChloride":[],"HKQuantityTypeIdentifierActiveEnergyBurned":[],"HKQuantityTypeIdentifierFlightsClimbed":[{"unit":"count","sdate":1446486600000,"value":1}],"HKQuantityTypeIdentifierForcedVitalCapacity":[],"HKQuantityTypeIdentifierBodyMass":[{"unit":"kg","sdate":1446486600000,"value":80}],"HKQuantityTypeIdentifierUVExposure":[],"HKQuantityTypeIdentifierDietaryVitaminA":[],"HKQuantityTypeIdentifierDietaryCaffeine":[],"HKQuantityTypeIdentifierDietaryVitaminC":[],"HKQuantityTypeIdentifierDietaryVitaminD":[],"HKQuantityTypeIdentifierDietaryVitaminE":[],"HKCategoryTypeIdentifierOvulationTestResult":[],"HKCategoryTypeIdentifierSleepAnalysis":[],"HKCategoryTypeIdentifierCervicalMucusQuality":[],"HKCategoryTypeIdentifierMenstrualFlow":[],"HKCategoryTypeIdentifierIntermenstrualBleeding":[],"HKCategoryTypeIdentifierSexualActivity":[],"HKCorrelationTypeIdentifierBloodPressure":[{"sdate":1446573540000,"objects":[{"sdate":1446573540000,"value":120,"unit":"mmHg","type":"HKQuantityTypeIdentifierBloodPressureSystolic"},{"sdate":1446573540000,"value":80,"unit":"mmHg","type":"HKQuantityTypeIdentifierBloodPressureDiastolic"}]}],"HKCorrelationTypeIdentifierFood":[],"HKCorrelationTypeIdentifierBloodPressure":[],"HKWorkoutTypeIdentifier":[{"workoutActivityType":37,"totalEnergyBurned":90,"edate":1446486660000,"duration":840,"workoutEvents":[],"totalDistance":3218.688,"sdate":1446485820000}]}

0 comments on commit f897ecd

Please sign in to comment.