From fff092e37b3e3fa7c7401005e7b358fb54af60b3 Mon Sep 17 00:00:00 2001
From: Gavi Rawson <51756298+gavirawson-apple@users.noreply.github.com>
Date: Thu, 21 Sep 2023 16:39:01 -0700
Subject: [PATCH] 3.0.1 Beta 2 Release (#703)
---
.gitignore | 3 +-
.../xcschemes/CareKit (SPM).xcscheme | 80 +++++++++++
.../xcschemes/CareKitFHIR (SPM).xcscheme | 80 +++++++++++
.../xcschemes/CareKitStore (SPM).xcscheme | 80 +++++++++++
.../xcschemes/CareKitUI (SPM).xcscheme | 80 +++++++++++
.../contents.xcworkspacedata | 3 +
CareKit/CareKit.docc/CareKit.md | 88 +++++++++++-
...ing-and-Displaying-Tasks-for-a-Patient.md} | 0
...Setting-up-Your-Project-to-Use-CareKit.md} | 0
...ng-up-your-project-to-use-carekit-1@2x.png | Bin
...ng-up-your-project-to-use-carekit-2@2x.png | Bin
...ng-up-your-project-to-use-carekit-3@2x.png | Bin
.../OCKDataSeriesConfiguration.swift | 4 +-
.../OCKContactsListViewController.swift | 4 +-
.../OCKDailyPageViewController.swift | 4 +-
.../OCKSurveyTaskViewSynchronizer.swift | 2 +-
.../OCKSurveyTaskViewController.swift | 59 +++-----
.../OCKTaskViewController.swift | 2 +-
.../CareKitFHIR.xcodeproj/project.pbxproj | 6 +-
.../Integration Tests/CareKitFHIRTests.swift | 18 +--
.../DSTU2MedicationOrderConverterTests.swift | 24 ++--
.../DSTU2PatientConverterTests.swift | 22 +--
.../Unit Tests/DSTU2TaskConverterTests.swift | 48 +++----
.../Unit Tests/FHIRResourceDataTests.swift | 4 +-
.../Unit Tests/R4PatientConverterTests.swift | 22 +--
.../CareKitStore.docc/CareKitStore.md | 132 ++++++++++++++++--
.../Creating-Schedules-for-Tasks.md} | 0
.../CareKitStore/CoreData/OCKCDCarePlan.swift | 7 +-
.../CareKitStore/CoreData/OCKCDClock.swift | 1 +
.../CareKitStore/CoreData/OCKCDContact.swift | 35 +++--
.../CoreData/OCKCDHealthKitLinkage.swift | 16 ++-
.../CoreData/OCKCDHealthKitTask.swift | 26 ++--
.../CareKitStore/CoreData/OCKCDNote.swift | 8 +-
.../CareKitStore/CoreData/OCKCDOutcome.swift | 18 ++-
.../CoreData/OCKCDOutcomeValue.swift | 12 +-
.../CareKitStore/CoreData/OCKCDPatient.swift | 14 +-
.../CoreData/OCKCDPersonName.swift | 16 ++-
.../CoreData/OCKCDPostalAddress.swift | 20 +--
.../CoreData/OCKCDScheduleElement.swift | 23 +--
.../CareKitStore/CoreData/OCKCDTask.swift | 24 ++--
.../CoreData/OCKStore+HealthKit.swift | 1 +
.../CoreData/OCKStore+Outcomes.swift | 1 +
.../CoreData/OCKStore+Tasks.swift | 1 +
.../CoreData/OCKStore+Transactions.swift | 2 +
.../CareKitStore/CoreData/OCKStore.swift | 24 +++-
.../OCKStore+Synchronization.swift | 5 +
.../OCKHealthKitPassthroughStore.swift | 12 +-
.../OCKStoreCoordinator.swift | 24 +++-
.../Streaming/CoreDataQueryMonitor.swift | 2 +-
.../Structs/OCKScheduleEvent.swift | 7 -
.../Structs/Queries/OCKAdherenceQuery.swift | 4 +-
.../TestCoreDataSchema+Migrations.swift | 6 +-
.../TestHealthKitStore+Tasks.swift | 38 ++---
.../OCKStore/TestStore+BuildRevisions.swift | 66 ++++-----
.../OCKStore/TestStore+CRDT.swift | 10 +-
.../OCKStore/TestStore+CarePlans.swift | 50 +++----
.../OCKStore/TestStore+ConsumeRevisions.swift | 60 ++++----
.../OCKStore/TestStore+Contacts.swift | 72 +++++-----
.../OCKStore/TestStore+Notes.swift | 8 +-
.../OCKStore/TestStore+Outcomes.swift | 32 ++---
.../OCKStore/TestStore+Patients.swift | 24 ++--
.../OCKStore/TestStore+ResolveConflicts.swift | 4 +-
.../OCKStore/TestStore+Sync.swift | 38 ++---
.../OCKStore/TestStore+Tasks.swift | 70 +++++-----
.../OCKStore/TestStore.swift | 8 +-
.../TestPersistentStoreCoordinator.swift | 10 +-
.../Structs/TestHealthKitLinkage.swift | 2 +-
.../Structs/TestKnowledgeVector.swift | 16 ++-
.../Structs/TestOutcome.swift | 2 +-
.../Structs/TestOutcomeValue.swift | 28 ++--
.../Structs/TestPatient.swift | 2 +-
.../Structs/TestSchedule.swift | 54 +++----
.../Structs/TestScheduleElement.swift | 32 ++---
.../Structs/TestScheduleEvent.swift | 8 +-
.../Structs/TestSemanticVersion.swift | 34 ++---
.../CareKitStoreTests/Structs/TestTask.swift | 16 +--
.../CareKitStoreTests/TestPartialEvents.swift | 30 ++--
.../TestStoreProtocolExtensions.swift | 38 ++---
.../TestWatchConnectivityPeer.swift | 16 +--
CareKitUI/CareKitUI.docc/CareKitUI.md | 128 +++++++++++++++--
CareKitUI/CareKitUI/iOS/Link/LinkButton.swift | 2 +-
.../CareKitUI/iOS/OCKResponsiveLayout.swift | 14 +-
.../CareKitUITests/Link/TestLinkType.swift | 2 +-
.../OCKResponsiveLayoutTests.swift | 24 ++--
Package.swift | 10 +-
85 files changed, 1371 insertions(+), 651 deletions(-)
create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/CareKit (SPM).xcscheme
create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/CareKitFHIR (SPM).xcscheme
create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/CareKitStore (SPM).xcscheme
create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/CareKitUI (SPM).xcscheme
rename CareKit/CareKit.docc/Resources/{Creating and Displaying Tasks for a Patient/Creating and Displaying Tasks for a Patient.md => Creating-and-Displaying-Tasks-for-a-Patient/Creating-and-Displaying-Tasks-for-a-Patient.md} (100%)
rename CareKit/CareKit.docc/Resources/{Setting Up Your Project to Use CareKit/Setting up Your Project to Use CareKit.md => Setting-Up-Your-Project-to-Use-CareKit/Setting-up-Your-Project-to-Use-CareKit.md} (100%)
rename CareKit/CareKit.docc/Resources/{Setting Up Your Project to Use CareKit => Setting-Up-Your-Project-to-Use-CareKit}/setting-up-your-project-to-use-carekit-1@2x.png (100%)
rename CareKit/CareKit.docc/Resources/{Setting Up Your Project to Use CareKit => Setting-Up-Your-Project-to-Use-CareKit}/setting-up-your-project-to-use-carekit-2@2x.png (100%)
rename CareKit/CareKit.docc/Resources/{Setting Up Your Project to Use CareKit => Setting-Up-Your-Project-to-Use-CareKit}/setting-up-your-project-to-use-carekit-3@2x.png (100%)
rename CareKitStore/CareKitStore.docc/{Creating Schedules for Tasks/Creating Schedules for Tasks.md => Creating-Schedules-for-Tasks/Creating-Schedules-for-Tasks.md} (100%)
diff --git a/.gitignore b/.gitignore
index 2d24cc563..cc9469bc7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,7 +25,8 @@ DerivedData
# SPM
.build/
-.swiftpm/
+.swiftpm/xcode/*
+!.swiftpm/xcode/xcshareddata/
# DocC
.docc-build
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CareKit (SPM).xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CareKit (SPM).xcscheme
new file mode 100644
index 000000000..700c29c8f
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/CareKit (SPM).xcscheme
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CareKitFHIR (SPM).xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitFHIR (SPM).xcscheme
new file mode 100644
index 000000000..aa4524e7b
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitFHIR (SPM).xcscheme
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CareKitStore (SPM).xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitStore (SPM).xcscheme
new file mode 100644
index 000000000..41850d3f4
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitStore (SPM).xcscheme
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CareKitUI (SPM).xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitUI (SPM).xcscheme
new file mode 100644
index 000000000..a3e8939d5
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/CareKitUI (SPM).xcscheme
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CKWorkspace.xcworkspace/contents.xcworkspacedata b/CKWorkspace.xcworkspace/contents.xcworkspacedata
index e17b28f69..8ad1b9e53 100644
--- a/CKWorkspace.xcworkspace/contents.xcworkspacedata
+++ b/CKWorkspace.xcworkspace/contents.xcworkspacedata
@@ -1,6 +1,9 @@
+
+
diff --git a/CareKit/CareKit.docc/CareKit.md b/CareKit/CareKit.docc/CareKit.md
index 74406a659..92adc4cb9 100644
--- a/CareKit/CareKit.docc/CareKit.md
+++ b/CareKit/CareKit.docc/CareKit.md
@@ -1,9 +1,11 @@
# ``CareKit``
-CareKit is an open source framework that you can use to build apps to manage and understand health data. Apps can highlight trends, celebrate goals, and create incentives for users. CareKit makes it easy to provide engaging, consistent interfaces with delightful animations, and full interaction with the accessibility features of iOS and iPadOS.
+Create apps that help people better understand and manage their health.
## Overview
+CareKit is an open source framework that you can use to build apps to manage and understand health data. Apps can highlight trends, celebrate goals, and create incentives for users. CareKit makes it easy to provide engaging, consistent interfaces with delightful animations, and full interaction with the accessibility features of iOS and iPadOS.
+
This open source framework is written entirely in Swift, and leverages some of the most powerful Swift language features.
Your CareKit apps can:
@@ -14,8 +16,90 @@ Your CareKit apps can:
- Allow users to connect with their care providers.
-The framework provides a powerful set of data models for persistence. Your app’s user is represented in CareKit’s data as a patient. A patient needs to complete a set of tasks, like taking a medication or logging their symptoms. Create tasks with a schedule so that patients know when to perform each task. Schedules are composable, so you can build a complex set of requirements by combining simple ones.
+The framework provides a powerful set of data models for persistence. Your app represents a user as a patient in CareKit's data; a patient completes a set of tasks, such as taking a medication or logging a symptom. Create tasks with a schedule to indicate when to perform each task, and build schedules with complex requirements by combining simple ones.
The combination of a patient’s tasks make up a care plan. A care plan helps a user improve part of their health; for example, recovering from an operation or managing diabetes. A patient can have multiple care plans, and each care plan can have contacts associated to them. Contacts are the patient’s care providers.
When a patient completes a task, CareKit stores results as outcomes. These outcomes and their associated values enable you to provide charts and graphs for a user to help them understand the health impact of their care plan.
+
+
+## Topics
+
+### Essentials
+
+-
+-
+
+### Displaying synchronized care data in SwiftUI
+
+- ``CareStoreFetchRequest``
+- ``CareStoreFetchedResults``
+- ``CareStoreFetchedResult``
+
+### Displaying synchronized care data in UIKit
+
+- ``ViewSynchronizing``
+- ``SynchronizedViewController``
+- ``OCKSynchronizationContext``
+
+### Displaying care tasks in UIKit
+
+- ``OCKTaskViewController``
+- ``OCKSimpleTaskViewController``
+- ``OCKInstructionsTaskViewController``
+- ``OCKChecklistTaskViewController``
+- ``OCKGridTaskViewController``
+- ``OCKButtonLogTaskViewController``
+- ``OCKTaskEvents``
+- ``OCKSimpleTaskViewSynchronizer``
+- ``OCKInstructionsTaskViewSynchronizer``
+- ``OCKChecklistTaskViewSynchronizer``
+- ``OCKGridTaskViewSynchronizer``
+- ``OCKButtonLogTaskViewSynchronizer``
+- ``OCKTaskViewSynchronizerProtocol``
+- ``OCKAnyTaskViewSynchronizerProtocol``
+
+### Displaying care task details
+
+- ``OCKDetailViewController``
+
+### Displaying contacts in UIKit
+
+- ``OCKContactViewController``
+- ``OCKSimpleContactViewController``
+- ``OCKDetailedContactViewController``
+- ``OCKContactsListViewController``
+- ``OCKSimpleContactViewSynchronizer``
+- ``OCKDetailedContactViewSynchronizer``
+- ``OCKContactViewSynchronizerProtocol``
+- ``OCKAnyContactViewSynchronizerProtocol``
+
+### Displaying a chart in UIKit
+
+- ``OCKChartViewController``
+- ``OCKCartesianChartViewController``
+- ``OCKDataSeriesConfiguration``
+- ``OCKCartesianChartViewSynchronizer``
+- ``OCKChartViewSynchronizerProtocol``
+
+### Displaying a calendar in UIKit
+
+- ``OCKCalendarViewController``
+- ``OCKWeekCalendarViewController``
+- ``OCKWeekCalendarViewSynchronizer``
+- ``OCKCalendarViewSynchronizerProtocol``
+
+### Displaying care data over time in UIKit
+
+- ``OCKDailyTasksPageViewController``
+- ``OCKDailyTasksPageViewControllerDelegate``
+- ``OCKDailyPageViewController``
+- ``OCKDailyPageViewControllerDataSource``
+- ``OCKDailyPageViewControllerDelegate``
+- ``OCKWeekCalendarPageViewController``
+- ``OCKWeekCalendarPageViewControllerDelegate``
+- ``OCKListViewController``
+
+### Logging
+
+- ``OCKLog``
diff --git a/CareKit/CareKit.docc/Resources/Creating and Displaying Tasks for a Patient/Creating and Displaying Tasks for a Patient.md b/CareKit/CareKit.docc/Resources/Creating-and-Displaying-Tasks-for-a-Patient/Creating-and-Displaying-Tasks-for-a-Patient.md
similarity index 100%
rename from CareKit/CareKit.docc/Resources/Creating and Displaying Tasks for a Patient/Creating and Displaying Tasks for a Patient.md
rename to CareKit/CareKit.docc/Resources/Creating-and-Displaying-Tasks-for-a-Patient/Creating-and-Displaying-Tasks-for-a-Patient.md
diff --git a/CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/Setting up Your Project to Use CareKit.md b/CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/Setting-up-Your-Project-to-Use-CareKit.md
similarity index 100%
rename from CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/Setting up Your Project to Use CareKit.md
rename to CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/Setting-up-Your-Project-to-Use-CareKit.md
diff --git a/CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-1@2x.png b/CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-1@2x.png
similarity index 100%
rename from CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-1@2x.png
rename to CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-1@2x.png
diff --git a/CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-2@2x.png b/CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-2@2x.png
similarity index 100%
rename from CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-2@2x.png
rename to CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-2@2x.png
diff --git a/CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-3@2x.png b/CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-3@2x.png
similarity index 100%
rename from CareKit/CareKit.docc/Resources/Setting Up Your Project to Use CareKit/setting-up-your-project-to-use-carekit-3@2x.png
rename to CareKit/CareKit.docc/Resources/Setting-Up-Your-Project-to-Use-CareKit/setting-up-your-project-to-use-carekit-3@2x.png
diff --git a/CareKit/CareKit/iOS/Chart/View Controllers/OCKDataSeriesConfiguration.swift b/CareKit/CareKit/iOS/Chart/View Controllers/OCKDataSeriesConfiguration.swift
index 42ddeea3d..cd5ed2d4f 100644
--- a/CareKit/CareKit/iOS/Chart/View Controllers/OCKDataSeriesConfiguration.swift
+++ b/CareKit/CareKit/iOS/Chart/View Controllers/OCKDataSeriesConfiguration.swift
@@ -54,7 +54,9 @@ public struct OCKDataSeriesConfiguration {
/// A closure that accepts as an argument a day's worth of events and returns a y-axis value for that day.
@available(*, unavailable, message: "The aggregator is no longer available and will be removed in a future version of CareKit.")
- public var aggregator: OCKAdherenceAggregator!
+ public var aggregator: OCKAdherenceAggregator! {
+ fatalError("Property is unavailable")
+ }
let computeProgress: (OCKAnyEvent) -> LinearCareTaskProgress
diff --git a/CareKit/CareKit/iOS/Contact/View Controllers/OCKContactsListViewController.swift b/CareKit/CareKit/iOS/Contact/View Controllers/OCKContactsListViewController.swift
index be8bd45b3..6b7b269c2 100644
--- a/CareKit/CareKit/iOS/Contact/View Controllers/OCKContactsListViewController.swift
+++ b/CareKit/CareKit/iOS/Contact/View Controllers/OCKContactsListViewController.swift
@@ -56,7 +56,9 @@ open class OCKContactsListViewController<
)
@available(*, unavailable, message: "The storeManager is unavailable.")
- public var storeManager: OCKSynchronizedStoreManager!
+ public var storeManager: OCKSynchronizedStoreManager! {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, renamed: "init(store:contactViewSynchronizer:)")
public init(storeManager: OCKSynchronizedStoreManager) {
diff --git a/CareKit/CareKit/iOS/Higher Order/ViewController/OCKDailyPageViewController.swift b/CareKit/CareKit/iOS/Higher Order/ViewController/OCKDailyPageViewController.swift
index 2c35534a2..eb7e9657a 100644
--- a/CareKit/CareKit/iOS/Higher Order/ViewController/OCKDailyPageViewController.swift
+++ b/CareKit/CareKit/iOS/Higher Order/ViewController/OCKDailyPageViewController.swift
@@ -79,7 +79,9 @@ UIPageViewControllerDataSource, UIPageViewControllerDelegate {
/// The store manager the view controller uses for synchronization.
@available(*, unavailable, renamed: "store")
- public var storeManager: OCKSynchronizedStoreManager!
+ public var storeManager: OCKSynchronizedStoreManager! {
+ fatalError("Property is unavailable")
+ }
/// The store the view controller uses for synchronization.
public let store: OCKAnyStoreProtocol
diff --git a/CareKit/CareKit/iOS/Task/Synchronizers/OCKSurveyTaskViewSynchronizer.swift b/CareKit/CareKit/iOS/Task/Synchronizers/OCKSurveyTaskViewSynchronizer.swift
index 3beec4222..ad2233ec3 100644
--- a/CareKit/CareKit/iOS/Task/Synchronizers/OCKSurveyTaskViewSynchronizer.swift
+++ b/CareKit/CareKit/iOS/Task/Synchronizers/OCKSurveyTaskViewSynchronizer.swift
@@ -31,7 +31,7 @@
import CareKitUI
-open class OCKSurveyTaskViewSynchronizer: ViewSynchronizing {
+open class OCKSurveyTaskViewSynchronizer: OCKInstructionsTaskViewSynchronizer {
override open func makeView() -> OCKInstructionsTaskView {
let view = super.makeView()
diff --git a/CareKit/CareKit/iOS/Task/View Controllers/OCKSurveyTaskViewController.swift b/CareKit/CareKit/iOS/Task/View Controllers/OCKSurveyTaskViewController.swift
index dc42264a4..5b4e8141e 100644
--- a/CareKit/CareKit/iOS/Task/View Controllers/OCKSurveyTaskViewController.swift
+++ b/CareKit/CareKit/iOS/Task/View Controllers/OCKSurveyTaskViewController.swift
@@ -72,7 +72,7 @@ open class OCKSurveyTaskViewController: OCKTaskViewController [OCKOutcomeValue]?
) {
-
- var eventQuery = eventQuery
- eventQuery.taskIDs = [task.id]
-
- self.init(
- query: eventQuery,
- store: storeManager.store,
- survey: survey,
- viewSynchronizer: viewSynchronizer,
- extractOutcome: extractOutcome
- )
+ fatalError("Unavailable")
}
- @available(*, deprecated, renamed: "init(query:store:survey:viewSynchronizer:extractOutcome:)")
+ @available(*, unavailable, renamed: "init(query:store:survey:viewSynchronizer:extractOutcome:)")
public init(
taskID: String,
eventQuery: OCKEventQuery,
@@ -103,16 +93,7 @@ open class OCKSurveyTaskViewController: OCKTaskViewController [OCKOutcomeValue]?
) {
- var eventQuery = eventQuery
- eventQuery.taskIDs = [taskID]
-
- self.init(
- query: eventQuery,
- store: storeManager.store,
- survey: survey,
- viewSynchronizer: viewSynchronizer,
- extractOutcome: extractOutcome
- )
+ fatalError("Unavailable")
}
public init(
@@ -124,8 +105,7 @@ open class OCKSurveyTaskViewController: OCKTaskViewController(data: samplePatientData)
let patient = try OCKR4PatientCoder().decode(resource)
- XCTAssert(patient.id == "pat1")
- XCTAssert(patient.name.familyName == "Donald")
- XCTAssert(patient.name.givenName == "Duck")
+ XCTAssertEqual(patient.id, "pat1")
+ XCTAssertEqual(patient.name.familyName, "Donald")
+ XCTAssertEqual(patient.name.givenName, "Duck")
}
func testParseFHIRCarePlanActivity() throws {
let resource = OCKFHIRResourceData(data: sampleCarePlanActivityData)
let task = try OCKDSTU2CarePlanActivityCoder().decode(resource)
- XCTAssert(task.id == "ABC")
- XCTAssert(task.schedule.elements.first?.interval == DateComponents(day: 2))
- XCTAssert(task.schedule.elements.first?.duration == .hours(1))
+ XCTAssertEqual(task.id, "ABC")
+ XCTAssertEqual(task.schedule.elements.first?.interval, DateComponents(day: 2))
+ XCTAssertEqual(task.schedule.elements.first?.duration, .hours(1))
}
func testParseFHIRMedicationOrder() throws {
@@ -55,9 +55,9 @@ class CareKitFHIRTests: XCTestCase {
var coder = OCKDSTU2MedicationOrderCoder()
coder.getCareKitSchedule = { _ in OCKSchedule.dailyAtTime(hour: 0, minutes: 0, start: Date(), end: nil, text: nil, duration: .allDay) }
let task = try coder.decode(resource)
- XCTAssert(task.id == "24")
- XCTAssert(task.instructions == "2 puffs every 2-4 hours")
- XCTAssert(task.schedule.elements.first?.interval == DateComponents(day: 1))
+ XCTAssertEqual(task.id, "24")
+ XCTAssertEqual(task.instructions, "2 puffs every 2-4 hours")
+ XCTAssertEqual(task.schedule.elements.first?.interval, DateComponents(day: 1))
}
func testParseFailsWhenDataIsCorrupt() {
diff --git a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2MedicationOrderConverterTests.swift b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2MedicationOrderConverterTests.swift
index 941d65fa4..945c64fc9 100644
--- a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2MedicationOrderConverterTests.swift
+++ b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2MedicationOrderConverterTests.swift
@@ -57,10 +57,10 @@ class DSTU2MedicationOrderConverterTest: XCTestCase {
medicationOrder.dosageInstruction = [instructions]
let task = try OCKDSTU2MedicationOrderCoder().convert(resource: medicationOrder)
- XCTAssert(task.id == "ABC")
- XCTAssert(task.title == "Title")
- XCTAssert(task.instructions == "Instructions")
- XCTAssert(task.schedule.elements.first?.interval == DateComponents(day: 1))
+ XCTAssertEqual(task.id, "ABC")
+ XCTAssertEqual(task.title, "Title")
+ XCTAssertEqual(task.instructions, "Instructions")
+ XCTAssertEqual(task.schedule.elements.first?.interval, DateComponents(day: 1))
}
func testConvertCareKitTaskToFHIRMedicationOrder() throws {
@@ -79,14 +79,14 @@ class DSTU2MedicationOrderConverterTest: XCTestCase {
return
}
- XCTAssert(medicationOrder.id?.value?.string == "ABC")
- XCTAssert(medicationOrder.dosageInstruction?.first?.text == "Instructions")
- XCTAssert(medicationOrder.dosageInstruction?.first?.timing?.repeat?.periodUnits == "d")
- XCTAssert(medicationOrder.dosageInstruction?.first?.timing?.repeat?.period == FHIRPrimitive(FHIRDecimal(1)))
- XCTAssert(medicationOrder.dosageInstruction?.first?.timing?.repeat?.durationUnits == "s")
- XCTAssert(medicationOrder.dosageInstruction?.first?.timing?.repeat?.duration == FHIRPrimitive(FHIRDecimal(10)))
- XCTAssert(period.start?.value?.foundationDate == startDate)
- XCTAssert(period.end?.value?.foundationDate == endDate)
+ XCTAssertEqual(medicationOrder.id?.value?.string, "ABC")
+ XCTAssertEqual(medicationOrder.dosageInstruction?.first?.text, "Instructions")
+ XCTAssertEqual(medicationOrder.dosageInstruction?.first?.timing?.repeat?.periodUnits, "d")
+ XCTAssertEqual(medicationOrder.dosageInstruction?.first?.timing?.repeat?.period, FHIRPrimitive(FHIRDecimal(1)))
+ XCTAssertEqual(medicationOrder.dosageInstruction?.first?.timing?.repeat?.durationUnits, "s")
+ XCTAssertEqual(medicationOrder.dosageInstruction?.first?.timing?.repeat?.duration, FHIRPrimitive(FHIRDecimal(10)))
+ XCTAssertEqual(period.start?.value?.foundationDate, startDate)
+ XCTAssertEqual(period.end?.value?.foundationDate, endDate)
}
func testOCKScheduleWithDateComponentsNilToTiming() throws {
diff --git a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2PatientConverterTests.swift b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2PatientConverterTests.swift
index f376d92ed..028e2d1be 100644
--- a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2PatientConverterTests.swift
+++ b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2PatientConverterTests.swift
@@ -51,7 +51,7 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.id == "abc")
+ XCTAssertEqual(converted.id, "abc")
}
func testConvertFHIRPatientSetsPatientSourceToFHIR() throws {
@@ -61,7 +61,7 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.source == "FHIR")
+ XCTAssertEqual(converted.source, "FHIR")
}
func testConvertFHIRPatientSucceedsForCustomIDGetter() throws {
@@ -76,7 +76,7 @@ class DSTU2PatientConverterTests: XCTestCase {
converter.getCareKitID = { $0.identifier!.first!.value!.value!.string }
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.id == "abc")
+ XCTAssertEqual(converted.id, "abc")
}
func testConvertFHIRPatientSucceedsForDefaultNameGetter() throws {
@@ -86,8 +86,8 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.name.familyName == "Bill")
- XCTAssert(converted.name.givenName == "Bob")
+ XCTAssertEqual(converted.name.familyName, "Bill")
+ XCTAssertEqual(converted.name.givenName, "Bob")
}
func testConvertFHIRPatientSucceedsForDefaultSexGetter() throws {
@@ -98,7 +98,7 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.sex == .other("other"))
+ XCTAssertEqual(converted.sex, .other("other"))
}
func testConvertFHIRPatientSucceedsForDefaultBirthdayGetter() throws {
@@ -116,7 +116,7 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.birthday == birthday)
+ XCTAssertEqual(converted.birthday, birthday)
}
// MARK: Convert OCKPatient to FHIR Patient
@@ -132,9 +132,9 @@ class DSTU2PatientConverterTests: XCTestCase {
let converter = OCKDSTU2PatientCoder()
let fhirPatient = try converter.convert(entity: careKitPatient)
- XCTAssert(fhirPatient.name?.first?.family == ["A"])
- XCTAssert(fhirPatient.name?.first?.given == ["B"])
- XCTAssert(fhirPatient.name?.first?.prefix == ["C"])
- XCTAssert(fhirPatient.name?.first?.suffix == ["D"])
+ XCTAssertEqual(fhirPatient.name?.first?.family, ["A"])
+ XCTAssertEqual(fhirPatient.name?.first?.given, ["B"])
+ XCTAssertEqual(fhirPatient.name?.first?.prefix, ["C"])
+ XCTAssertEqual(fhirPatient.name?.first?.suffix, ["D"])
}
}
diff --git a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2TaskConverterTests.swift b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2TaskConverterTests.swift
index e29144d0b..8cf47a1e7 100644
--- a/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2TaskConverterTests.swift
+++ b/CareKitFHIR/CareKitFHIRTests/Unit Tests/DSTU2TaskConverterTests.swift
@@ -69,7 +69,7 @@ class DSTU2TaskConverterTests: XCTestCase {
let converter = OCKDSTU2CarePlanActivityCoder()
let task = try converter.convert(resource: activity)
- XCTAssert(task.id == "abc")
+ XCTAssertEqual(task.id, "abc")
}
func testConvertFHIRTaskSucceedsForCustomIDGetter() throws {
@@ -90,7 +90,7 @@ class DSTU2TaskConverterTests: XCTestCase {
converter.getCareKitID = { $0.detail!.description_fhir!.value!.string }
let task = try converter.convert(resource: activity)
- XCTAssert(task.id == "abc")
+ XCTAssertEqual(task.id, "abc")
}
func testConvertFHIRTaskSucceedsForDefaultTitleGetter() throws {
@@ -111,7 +111,7 @@ class DSTU2TaskConverterTests: XCTestCase {
let converter = OCKDSTU2CarePlanActivityCoder()
let task = try converter.convert(resource: activity)
- XCTAssert(task.title == "title")
+ XCTAssertEqual(task.title, "title")
}
func testConvertFHIRTaskSucceedsForDefaultScheduleGetter() throws {
@@ -134,9 +134,9 @@ class DSTU2TaskConverterTests: XCTestCase {
let converter = OCKDSTU2CarePlanActivityCoder()
let task = try converter.convert(resource: activity)
- XCTAssert(task.schedule.elements.count == 1)
- XCTAssert(task.schedule.elements.first?.interval == DateComponents(day: 1))
- XCTAssert(task.schedule.elements.first?.duration == .hours(2))
+ XCTAssertEqual(task.schedule.elements.count, 1)
+ XCTAssertEqual(task.schedule.elements.first?.interval, DateComponents(day: 1))
+ XCTAssertEqual(task.schedule.elements.first?.duration, .hours(2))
}
func testConvertFHIRTaskSucceedsForAllDayScheduleElement() throws {
@@ -159,9 +159,9 @@ class DSTU2TaskConverterTests: XCTestCase {
let converter = OCKDSTU2CarePlanActivityCoder()
let task = try converter.convert(resource: activity)
- XCTAssert(task.schedule.elements.count == 1)
- XCTAssert(task.schedule.elements.first?.interval == DateComponents(day: 1))
- XCTAssert(task.schedule.elements.first?.duration == .allDay)
+ XCTAssertEqual(task.schedule.elements.count, 1)
+ XCTAssertEqual(task.schedule.elements.first?.interval, DateComponents(day: 1))
+ XCTAssertEqual(task.schedule.elements.first?.duration, .allDay)
}
// MARK: Convert OCKTask to FHIR Care Plan Activity
@@ -178,13 +178,13 @@ class DSTU2TaskConverterTests: XCTestCase {
return
}
- XCTAssert(activity.id == "abc")
- XCTAssert(activity.detail?.description_fhir == "title")
- XCTAssert(timing.repeat?.periodUnits == "d")
- XCTAssert(timing.repeat?.period == FHIRPrimitive(FHIRDecimal(2)))
- XCTAssert(timing.repeat?.frequency == FHIRPrimitive(1))
- XCTAssert(timing.repeat?.durationUnits == "s")
- XCTAssert(timing.repeat?.duration == FHIRPrimitive(FHIRDecimal(3_600)))
+ XCTAssertEqual(activity.id, "abc")
+ XCTAssertEqual(activity.detail?.description_fhir, "title")
+ XCTAssertEqual(timing.repeat?.periodUnits, "d")
+ XCTAssertEqual(timing.repeat?.period, FHIRPrimitive(FHIRDecimal(2)))
+ XCTAssertEqual(timing.repeat?.frequency, FHIRPrimitive(1))
+ XCTAssertEqual(timing.repeat?.durationUnits, "s")
+ XCTAssertEqual(timing.repeat?.duration, FHIRPrimitive(FHIRDecimal(3_600)))
}
func testConvertCareKitTaskToFHIRCarePlanActivityConvertsAllDayElementsCorrectly() throws {
@@ -204,14 +204,14 @@ class DSTU2TaskConverterTests: XCTestCase {
return
}
- XCTAssert(activity.id == "abc")
- XCTAssert(activity.detail?.description_fhir == "title")
- XCTAssert(timing.repeat?.periodUnits == "d")
- XCTAssert(timing.repeat?.period == FHIRPrimitive(FHIRDecimal(2)))
- XCTAssert(timing.repeat?.durationUnits == "s")
- XCTAssert(timing.repeat?.duration == FHIRPrimitive(FHIRDecimal(7_200)))
- XCTAssert(period.start?.value?.foundationDate == startDate)
- XCTAssert(period.end?.value?.foundationDate == endDate)
+ XCTAssertEqual(activity.id, "abc")
+ XCTAssertEqual(activity.detail?.description_fhir, "title")
+ XCTAssertEqual(timing.repeat?.periodUnits, "d")
+ XCTAssertEqual(timing.repeat?.period, FHIRPrimitive(FHIRDecimal(2)))
+ XCTAssertEqual(timing.repeat?.durationUnits, "s")
+ XCTAssertEqual(timing.repeat?.duration, FHIRPrimitive(FHIRDecimal(7_200)))
+ XCTAssertEqual(period.start?.value?.foundationDate, startDate)
+ XCTAssertEqual(period.end?.value?.foundationDate, endDate)
}
diff --git a/CareKitFHIR/CareKitFHIRTests/Unit Tests/FHIRResourceDataTests.swift b/CareKitFHIR/CareKitFHIRTests/Unit Tests/FHIRResourceDataTests.swift
index 9faab1388..abe8182bd 100644
--- a/CareKitFHIR/CareKitFHIRTests/Unit Tests/FHIRResourceDataTests.swift
+++ b/CareKitFHIR/CareKitFHIRTests/Unit Tests/FHIRResourceDataTests.swift
@@ -36,12 +36,12 @@ class FHIRResourceDataTests: XCTestCase {
func testInitializer() {
let rawData = "abc".data(using: .utf8)!
let resource = OCKFHIRResourceData(data: rawData)
- XCTAssert(resource.data == rawData)
+ XCTAssertEqual(resource.data, rawData)
}
func testDateConversion() {
let now = Date().truncatingNanoSeconds
let converted = now.dstu2FHIRDateTime.foundationDate
- XCTAssert(now == converted)
+ XCTAssertEqual(now, converted)
}
}
diff --git a/CareKitFHIR/CareKitFHIRTests/Unit Tests/R4PatientConverterTests.swift b/CareKitFHIR/CareKitFHIRTests/Unit Tests/R4PatientConverterTests.swift
index 988f08609..4422a4ffb 100644
--- a/CareKitFHIR/CareKitFHIRTests/Unit Tests/R4PatientConverterTests.swift
+++ b/CareKitFHIR/CareKitFHIRTests/Unit Tests/R4PatientConverterTests.swift
@@ -51,7 +51,7 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.id == "abc")
+ XCTAssertEqual(converted.id, "abc")
}
func testConvertFHIRPatientSetsPatientSourceToFHIR() throws {
@@ -61,7 +61,7 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.source == "FHIR")
+ XCTAssertEqual(converted.source, "FHIR")
}
func testConvertFHIRPatientSucceedsForCustomIDGetter() throws {
@@ -76,7 +76,7 @@ class R4PatientConverterTests: XCTestCase {
converter.getCareKitID = { $0.identifier!.first!.value!.value!.string }
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.id == "abc")
+ XCTAssertEqual(converted.id, "abc")
}
func testConvertFHIRPatientSucceedsForDefaultNameGetter() throws {
@@ -86,8 +86,8 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.name.familyName == "Bill")
- XCTAssert(converted.name.givenName == "Bob")
+ XCTAssertEqual(converted.name.familyName, "Bill")
+ XCTAssertEqual(converted.name.givenName, "Bob")
}
func testConvertFHIRPatientSucceedsForDefaultSexGetter() throws {
@@ -98,7 +98,7 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.sex == .other("other"))
+ XCTAssertEqual(converted.sex, .other("other"))
}
func testConvertFHIRPatientSucceedsForDefaultBirthdayGetter() throws {
@@ -116,7 +116,7 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let converted = try converter.convert(resource: patient)
- XCTAssert(converted.birthday == birthday)
+ XCTAssertEqual(converted.birthday, birthday)
}
// MARK: Convert OCKPatient to FHIR Patient
@@ -132,9 +132,9 @@ class R4PatientConverterTests: XCTestCase {
let converter = OCKR4PatientCoder()
let fhirPatient = try converter.convert(entity: careKitPatient)
- XCTAssert(fhirPatient.name?.first?.family == "A")
- XCTAssert(fhirPatient.name?.first?.given == ["B"])
- XCTAssert(fhirPatient.name?.first?.prefix == ["C"])
- XCTAssert(fhirPatient.name?.first?.suffix == ["D"])
+ XCTAssertEqual(fhirPatient.name?.first?.family, "A")
+ XCTAssertEqual(fhirPatient.name?.first?.given, ["B"])
+ XCTAssertEqual(fhirPatient.name?.first?.prefix, ["C"])
+ XCTAssertEqual(fhirPatient.name?.first?.suffix, ["D"])
}
}
diff --git a/CareKitStore/CareKitStore.docc/CareKitStore.md b/CareKitStore/CareKitStore.docc/CareKitStore.md
index 896d29cd7..1ed1074b0 100644
--- a/CareKitStore/CareKitStore.docc/CareKitStore.md
+++ b/CareKitStore/CareKitStore.docc/CareKitStore.md
@@ -1,21 +1,135 @@
# ``CareKitStore``
-CareKit is an open source framework that you can use to build apps to manage and understand health data. You apps can highlight trends, celebrate goals, and create incentives for users. CareKit makes it easy to provide engaging, consistent interfaces with delightful animations, and full interaction with the accessibility features of iOS and iPadOS.
+Store and retrieve patient care data.
## Overview
-This open source framework is written entirely in Swift, and it leverages some of the most powerful Swift language features.
+CareKitStore provides a Core Data solution for storing and retrieving patient care data. It provides the ability to use a custom store, such as a third-party database.
-Your CareKit apps can:
+## Topics
-- Easily digitize a prescription.
+### Essentials
-- Provide meaningful health data and trends to users.
+
-- Allow users to connect with their care providers.
+### Stores
-The framework provides a powerful set of data models for persistence. Your app’s user is represented in CareKit’s data as a patient. A patient needs to complete a set of tasks, like taking a medication or logging their symptoms. Tasks are created with a schedule, so a patient knows when to perform each task. Schedules are composable, so you can build a complex set of requirements by combining simple ones.
+- ``OCKStore``
+- ``OCKCoreDataStoreType``
+- ``OCKHealthKitPassthroughStore``
+- ``OCKStoreCoordinator``
+- ``OCKStoreError``
+- ``OCKAnyStoreProtocol``
+- ``OCKStoreProtocol``
+- ``OCKAnyResettableStore``
+- ``OCKResultClosure``
+- ``CareStoreQueryResults``
-The combination of a patient’s tasks make up a care plan. A care plan is designed to help a user improve part of their health, for example, recovering from an operation or managing diabetes. A patient can have multiple care plans, and each care plan can have contacts associated to them. Contacts are the patient’s care providers.
+### Care tasks
-When a patient completes a task, the results are stored as outcomes. These outcomes and their associated values enable you to provide charts and graphs for a user, that help them understand the health impact of their care plan.
+- ``OCKTask``
+- ``OCKAnyTask``
+- ``OCKAnyVersionableTask``
+- ``OCKHealthKitTask``
+- ``OCKHealthKitLinkage``
+- ``OCKTaskStore``
+- ``OCKAnyTaskStore``
+- ``OCKReadableTaskStore``
+- ``OCKAnyReadOnlyTaskStore``
+- ``OCKTaskQuery``
+
+### Care task scheduling
+
+- ``OCKSchedule``
+- ``OCKScheduleElement``
+
+### Events
+
+- ``OCKEvent``
+- ``OCKAnyEvent``
+- ``OCKScheduleEvent``
+- ``OCKEventStore``
+- ``OCKAnyEventStore``
+- ``OCKReadOnlyEventStore``
+- ``OCKAnyReadOnlyEventStore``
+- ``OCKEventQuery``
+
+### Outcomes
+
+- ``OCKOutcome``
+- ``OCKAnyOutcome``
+- ``OCKOutcomeValue``
+- ``OCKOutcomeValueType``
+- ``OCKOutcomeValueUnderlyingType``
+- ``OCKHealthKitOutcome``
+- ``OCKOutcomeStore``
+- ``OCKAnyOutcomeStore``
+- ``OCKReadableOutcomeStore``
+- ``OCKAnyReadOnlyOutcomeStore``
+- ``OCKOutcomeQuery``
+
+### Contacts
+
+- ``OCKContact``
+- ``OCKAnyContact``
+- ``OCKPostalAddress``
+- ``OCKBiologicalSex``
+- ``OCKContactCategory``
+- ``OCKLabeledValue``
+- ``OCKContactStore``
+- ``OCKAnyContactStore``
+- ``OCKAnyReadOnlyContactStore``
+- ``OCKReadableContactStore``
+- ``OCKContactQuery``
+
+### Care plans
+
+- ``OCKCarePlan``
+- ``OCKAnyCarePlan``
+- ``OCKCarePlanStore``
+- ``OCKAnyReadOnlyCarePlanStore``
+- ``OCKReadableCarePlanStore``
+- ``OCKAnyCarePlanStore``
+- ``OCKCarePlanQuery``
+
+### Patients
+
+- ``OCKPatient``
+- ``OCKAnyPatient``
+- ``OCKAnyPatientStore``
+- ``OCKAnyReadOnlyPatientStore``
+- ``OCKPatientStore``
+- ``OCKReadablePatientStore``
+- ``OCKPatientQuery``
+
+### Notes
+
+- ``OCKNote``
+
+### Care task progress
+
+- ``CareTaskProgress``
+- ``CareTaskProgressStrategy``
+- ``BinaryCareTaskProgress``
+- ``LinearCareTaskProgress``
+- ``AggregatedCareTaskProgress``
+- ``OCKEventAggregator``
+- ``OCKAdherenceQuery``
+- ``OCKAdherence``
+- ``OCKAdherenceAggregator``
+
+### Synchronization
+
+- ``OCKRemoteSynchronizable``
+- ``OCKRemoteSynchronizationDelegate``
+- ``OCKRevisionRecord``
+- ``OCKEntity``
+- ``OCKWatchConnectivityPeer``
+
+### Schema versioning
+
+- ``OCKSemanticVersion``
+
+### Logging
+
+- ``OCKLog``
diff --git a/CareKitStore/CareKitStore.docc/Creating Schedules for Tasks/Creating Schedules for Tasks.md b/CareKitStore/CareKitStore.docc/Creating-Schedules-for-Tasks/Creating-Schedules-for-Tasks.md
similarity index 100%
rename from CareKitStore/CareKitStore.docc/Creating Schedules for Tasks/Creating Schedules for Tasks.md
rename to CareKitStore/CareKitStore.docc/Creating-Schedules-for-Tasks/Creating-Schedules-for-Tasks.md
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDCarePlan.swift b/CareKitStore/CareKitStore/CoreData/OCKCDCarePlan.swift
index 6a75e74ce..7b56d4211 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDCarePlan.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDCarePlan.swift
@@ -52,9 +52,12 @@ class OCKCDCarePlan: OCKCDVersionedObject {
func makePlan() -> OCKCarePlan {
- var plan = OCKCarePlan(id: id, title: title, patientUUID: patient?.uuid)
+ var plan: OCKCarePlan!
- plan.copyVersionedValues(from: self)
+ self.managedObjectContext!.performAndWait {
+ plan = OCKCarePlan(id: id, title: title, patientUUID: patient?.uuid)
+ plan.copyVersionedValues(from: self)
+ }
return plan
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDClock.swift b/CareKitStore/CareKitStore/CoreData/OCKCDClock.swift
index 85776e04c..8521554a3 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDClock.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDClock.swift
@@ -54,6 +54,7 @@ class OCKCDClock: NSManagedObject {
static func fetch(context: NSManagedObjectContext) -> OCKCDClock {
let request = NSFetchRequest(entityName: String(describing: OCKCDClock.self))
request.fetchLimit = 1
+ request.returnsObjectsAsFaults = false
if let vector = try! context.fetch(request).first {
return vector
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDContact.swift b/CareKitStore/CareKitStore/CoreData/OCKCDContact.swift
index 5b4fcdcde..c07115e5e 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDContact.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDContact.swift
@@ -91,22 +91,27 @@ class OCKCDContact: OCKCDVersionedObject {
func makeContact() -> OCKContact {
- var contact = OCKContact(
- id: id,
- name: name.makeValue(),
- carePlanUUID: carePlan?.uuid
- )
+ var contact: OCKContact!
+
+ self.managedObjectContext!.performAndWait {
+ contact = OCKContact(
+ id: id,
+ name: name.makeValue(),
+ carePlanUUID: carePlan?.uuid
+ )
+
+ contact.copyVersionedValues(from: self)
+ contact.emailAddresses = emailAddresses
+ contact.messagingNumbers = messagingNumbers
+ contact.phoneNumbers = phoneNumbers
+ contact.otherContactInfo = otherContactInfo
+ contact.organization = organization
+ contact.title = title
+ contact.role = role
+ contact.category = category.map { OCKContactCategory(rawValue: $0)! }
+ contact.address = address?.makeValue()
+ }
- contact.copyVersionedValues(from: self)
- contact.emailAddresses = emailAddresses
- contact.messagingNumbers = messagingNumbers
- contact.phoneNumbers = phoneNumbers
- contact.otherContactInfo = otherContactInfo
- contact.organization = organization
- contact.title = title
- contact.role = role
- contact.category = category.map { OCKContactCategory(rawValue: $0)! }
- contact.address = address?.makeValue()
return contact
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitLinkage.swift b/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitLinkage.swift
index 2720a3d03..1b5cc9308 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitLinkage.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitLinkage.swift
@@ -50,10 +50,16 @@ class OCKCDHealthKitLinkage: NSManagedObject {
}
func makeValue() -> OCKHealthKitLinkage {
- OCKHealthKitLinkage(
- quantityIdentifier: HKQuantityTypeIdentifier(rawValue: quantityIdentifier),
- quantityType: OCKHealthKitLinkage.QuantityType(rawValue: quantityType)!,
- unit: HKUnit(from: unitString)
- )
+
+ var healthKitLinkage: OCKHealthKitLinkage!
+ self.managedObjectContext!.performAndWait {
+ healthKitLinkage = OCKHealthKitLinkage(
+ quantityIdentifier: HKQuantityTypeIdentifier(rawValue: quantityIdentifier),
+ quantityType: OCKHealthKitLinkage.QuantityType(rawValue: quantityType)!,
+ unit: HKUnit(from: unitString)
+ )
+ }
+
+ return healthKitLinkage
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitTask.swift b/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitTask.swift
index 205d417db..c891c4fba 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitTask.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDHealthKitTask.swift
@@ -60,17 +60,21 @@ class OCKCDHealthKitTask: OCKCDTaskBase {
func makeTask() -> OCKHealthKitTask {
- var task = OCKHealthKitTask(
- id: id,
- title: title,
- carePlanUUID: carePlan?.uuid,
- schedule: OCKSchedule(composing: scheduleElements.map { $0.makeValue() }),
- healthKitLinkage: healthKitLinkage.makeValue()
- )
-
- task.copyVersionedValues(from: self)
- task.instructions = instructions
- task.impactsAdherence = impactsAdherence
+ var task: OCKHealthKitTask!
+
+ self.managedObjectContext!.performAndWait {
+ task = OCKHealthKitTask(
+ id: id,
+ title: title,
+ carePlanUUID: carePlan?.uuid,
+ schedule: OCKSchedule(composing: scheduleElements.map { $0.makeValue() }),
+ healthKitLinkage: healthKitLinkage.makeValue()
+ )
+
+ task.copyVersionedValues(from: self)
+ task.instructions = instructions
+ task.impactsAdherence = impactsAdherence
+ }
return task
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDNote.swift b/CareKitStore/CareKitStore/CoreData/OCKCDNote.swift
index 8e4f0540f..27b42422b 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDNote.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDNote.swift
@@ -48,6 +48,12 @@ class OCKCDNote: NSManagedObject {
}
func makeValue() -> OCKNote {
- OCKNote(author: author, title: title, content: content)
+
+ var note: OCKNote!
+ self.managedObjectContext!.performAndWait {
+ note = OCKNote(author: author, title: title, content: content)
+ }
+
+ return note
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDOutcome.swift b/CareKitStore/CareKitStore/CoreData/OCKCDOutcome.swift
index 5a5c80ba2..297b369e3 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDOutcome.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDOutcome.swift
@@ -62,14 +62,18 @@ class OCKCDOutcome: OCKCDVersionedObject {
func makeOutcome() -> OCKOutcome {
- var outcome = OCKOutcome(
- taskUUID: task.uuid,
- taskOccurrenceIndex: Int(taskOccurrenceIndex),
- values: values.map { $0.makeValue() }
- )
-
- outcome.copyVersionedValues(from: self)
+ var outcome: OCKOutcome!
+ self.managedObjectContext!.performAndWait {
+ outcome = OCKOutcome(
+ taskUUID: task.uuid,
+ taskOccurrenceIndex: Int(taskOccurrenceIndex),
+ values: values.map { $0.makeValue() }
+ )
+
+ outcome.copyVersionedValues(from: self)
+ }
+
return outcome
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDOutcomeValue.swift b/CareKitStore/CareKitStore/CoreData/OCKCDOutcomeValue.swift
index a2dfe69c1..d6b853562 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDOutcomeValue.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDOutcomeValue.swift
@@ -59,9 +59,15 @@ class OCKCDOutcomeValue: NSManagedObject {
}
func makeValue() -> OCKOutcomeValue {
- var value = OCKOutcomeValue(self.value, units: units)
- value.createdDate = createdDate
- value.kind = kind
+
+ var value: OCKOutcomeValue!
+
+ self.managedObjectContext!.performAndWait {
+ value = OCKOutcomeValue(self.value, units: units)
+ value.createdDate = createdDate
+ value.kind = kind
+ }
+
return value
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDPatient.swift b/CareKitStore/CareKitStore/CoreData/OCKCDPatient.swift
index aaa9c848d..2cad7724a 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDPatient.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDPatient.swift
@@ -54,12 +54,14 @@ class OCKCDPatient: OCKCDVersionedObject {
func makePatient() -> OCKPatient {
- var patient = OCKPatient(id: id, name: name.makeValue())
-
- patient.copyVersionedValues(from: self)
- patient.sex = sex.map { OCKBiologicalSex(rawValue: $0)! }
- patient.birthday = birthday
- patient.allergies = allergies
+ var patient: OCKPatient!
+ self.managedObjectContext!.performAndWait {
+ patient = OCKPatient(id: id, name: name.makeValue())
+ patient.copyVersionedValues(from: self)
+ patient.sex = sex.map { OCKBiologicalSex(rawValue: $0)! }
+ patient.birthday = birthday
+ patient.allergies = allergies
+ }
return patient
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDPersonName.swift b/CareKitStore/CareKitStore/CoreData/OCKCDPersonName.swift
index 3bcb2602e..3aa2df78d 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDPersonName.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDPersonName.swift
@@ -56,13 +56,17 @@ class OCKCDPersonName: NSManagedObject {
}
func makeValue() -> PersonNameComponents {
+
var components = PersonNameComponents()
- components.namePrefix = namePrefix
- components.givenName = givenName
- components.familyName = familyName
- components.nameSuffix = nameSuffix
- components.nickname = nickname
- components.phoneticRepresentation = phoneticRepresentation?.makeValue()
+ self.managedObjectContext!.performAndWait {
+ components.namePrefix = namePrefix
+ components.givenName = givenName
+ components.familyName = familyName
+ components.nameSuffix = nameSuffix
+ components.nickname = nickname
+ components.phoneticRepresentation = phoneticRepresentation?.makeValue()
+ }
+
return components
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDPostalAddress.swift b/CareKitStore/CareKitStore/CoreData/OCKCDPostalAddress.swift
index 86770890c..161b88c1d 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDPostalAddress.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDPostalAddress.swift
@@ -54,15 +54,19 @@ class OCKCDPostalAddress: NSManagedObject {
}
func makeValue() -> OCKPostalAddress {
+
let address = OCKPostalAddress()
- address.street = street
- address.subLocality = subLocality
- address.city = city
- address.subAdministrativeArea = subAdministrativeArea
- address.state = state
- address.postalCode = postalCode
- address.country = country
- address.isoCountryCode = isoCountryCode
+ self.managedObjectContext!.performAndWait {
+ address.street = street
+ address.subLocality = subLocality
+ address.city = city
+ address.subAdministrativeArea = subAdministrativeArea
+ address.state = state
+ address.postalCode = postalCode
+ address.country = country
+ address.isoCountryCode = isoCountryCode
+ }
+
return address
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDScheduleElement.swift b/CareKitStore/CareKitStore/CoreData/OCKCDScheduleElement.swift
index 15358379e..22d039f7d 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDScheduleElement.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDScheduleElement.swift
@@ -66,14 +66,21 @@ class OCKCDScheduleElement: NSManagedObject {
}
func makeValue() -> OCKScheduleElement {
- OCKScheduleElement(
- start: startDate,
- end: endDate,
- interval: interval,
- text: text,
- targetValues: targetValues.map { $0.makeValue() },
- duration: duration
- )
+
+ var scheduleElement: OCKScheduleElement!
+
+ self.managedObjectContext!.performAndWait {
+ scheduleElement = OCKScheduleElement(
+ start: startDate,
+ end: endDate,
+ interval: interval,
+ text: text,
+ targetValues: targetValues.map { $0.makeValue() },
+ duration: duration
+ )
+ }
+
+ return scheduleElement
}
var duration: OCKScheduleElement.Duration {
diff --git a/CareKitStore/CareKitStore/CoreData/OCKCDTask.swift b/CareKitStore/CareKitStore/CoreData/OCKCDTask.swift
index 4ee6d96ea..24b13b254 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKCDTask.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKCDTask.swift
@@ -66,17 +66,21 @@ class OCKCDTask: OCKCDTaskBase {
func makeTask() -> OCKTask {
- var task = OCKTask(
- id: id,
- title: title,
- carePlanUUID: carePlan?.uuid,
- schedule: OCKSchedule(composing: scheduleElements.map { $0.makeValue() })
- )
-
- task.copyVersionedValues(from: self)
- task.instructions = instructions
- task.impactsAdherence = impactsAdherence
+ var task: OCKTask!
+ self.managedObjectContext!.performAndWait {
+ task = OCKTask(
+ id: id,
+ title: title,
+ carePlanUUID: carePlan?.uuid,
+ schedule: OCKSchedule(composing: scheduleElements.map { $0.makeValue() })
+ )
+
+ task.copyVersionedValues(from: self)
+ task.instructions = instructions
+ task.impactsAdherence = impactsAdherence
+ }
+
return task
}
}
diff --git a/CareKitStore/CareKitStore/CoreData/OCKStore+HealthKit.swift b/CareKitStore/CareKitStore/CoreData/OCKStore+HealthKit.swift
index cac80c935..401789baf 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKStore+HealthKit.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKStore+HealthKit.swift
@@ -76,6 +76,7 @@ extension OCKStore {
let request = NSFetchRequest(entityName: OCKCDHealthKitTask.entity().name!)
request.fetchLimit = query.limit ?? 0
request.fetchOffset = query.offset
+ request.returnsObjectsAsFaults = false
request.sortDescriptors = self.buildSortDescriptors(for: query)
request.predicate = self.buildPredicate(for: query)
diff --git a/CareKitStore/CareKitStore/CoreData/OCKStore+Outcomes.swift b/CareKitStore/CareKitStore/CoreData/OCKStore+Outcomes.swift
index 87a4ee571..af4e2f09f 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKStore+Outcomes.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKStore+Outcomes.swift
@@ -76,6 +76,7 @@ extension OCKStore {
let request = NSFetchRequest(entityName: String(describing: OCKCDOutcome.self))
request.fetchLimit = query.limit ?? 0
request.fetchOffset = query.offset
+ request.returnsObjectsAsFaults = false
request.sortDescriptors = self.buildSortDescriptors(for: query)
request.predicate = self.buildPredicate(for: query)
let objects = try self.context.fetch(request)
diff --git a/CareKitStore/CareKitStore/CoreData/OCKStore+Tasks.swift b/CareKitStore/CareKitStore/CoreData/OCKStore+Tasks.swift
index 12aa5a6ce..77ee22344 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKStore+Tasks.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKStore+Tasks.swift
@@ -143,6 +143,7 @@ extension OCKStore {
private func confirmUpdateWillNotCauseDataLoss(tasks: [OCKTask]) throws {
let request = NSFetchRequest(entityName: OCKCDTask.entity().name!)
request.predicate = OCKCDTask.headerPredicate(tasks)
+ request.returnsObjectsAsFaults = false
let heads = try context.fetch(request)
for task in heads {
diff --git a/CareKitStore/CareKitStore/CoreData/OCKStore+Transactions.swift b/CareKitStore/CareKitStore/CoreData/OCKStore+Transactions.swift
index 69f2e2317..a45777430 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKStore+Transactions.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKStore+Transactions.swift
@@ -55,6 +55,7 @@ extension OCKStore {
request.sortDescriptors = sortDescriptors
request.fetchLimit = limit ?? 0
request.fetchOffset = offset
+ request.returnsObjectsAsFaults = false
let fetched = try self.context.fetch(request)
@@ -127,6 +128,7 @@ extension OCKStore {
let request = NSFetchRequest(entityName: name)
request.predicate = OCKCDVersionedObject.headerPredicate([value])
+ request.returnsObjectsAsFaults = false
let tips = try context.fetch(request)
diff --git a/CareKitStore/CareKitStore/CoreData/OCKStore.swift b/CareKitStore/CareKitStore/CoreData/OCKStore.swift
index 469e6be30..4ad1ebd9b 100644
--- a/CareKitStore/CareKitStore/CoreData/OCKStore.swift
+++ b/CareKitStore/CareKitStore/CoreData/OCKStore.swift
@@ -83,32 +83,44 @@ open class OCKStore: OCKStoreProtocol, Equatable {
/// The delegate receives callbacks when the contents of the patient store are modified.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var patientDelegate: OCKPatientStoreDelegate?
+ public weak var patientDelegate: OCKPatientStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
/// The delegate receives callbacks when the contents of the care plan store are modified.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var carePlanDelegate: OCKCarePlanStoreDelegate?
+ public weak var carePlanDelegate: OCKCarePlanStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
/// The delegate receives callbacks when the contents of the contacts store are modified.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var contactDelegate: OCKContactStoreDelegate?
+ public weak var contactDelegate: OCKContactStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
/// The delegate receives callbacks when the contents of the tasks store are modified.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var taskDelegate: OCKTaskStoreDelegate?
+ public weak var taskDelegate: OCKTaskStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
/// The delegate receives callbacks when the contents of the outcome store are modified.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var outcomeDelegate: OCKOutcomeStoreDelegate?
+ public weak var outcomeDelegate: OCKOutcomeStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
/// The delegate receives callbacks when the contents of the store are reset.
/// In `CareKit` apps, the delegate will be set automatically, and it should not be modified.
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var resetDelegate: OCKResetDelegate?
+ public weak var resetDelegate: OCKResetDelegate? {
+ fatalError("Property is unavailable")
+ }
/// Two instances of `OCKStore` are considered to be equal if they have the same name and store type.
diff --git a/CareKitStore/CareKitStore/CoreData/Synchronization/OCKStore+Synchronization.swift b/CareKitStore/CareKitStore/CoreData/Synchronization/OCKStore+Synchronization.swift
index 59fc65c22..95fc754d9 100644
--- a/CareKitStore/CareKitStore/CoreData/Synchronization/OCKStore+Synchronization.swift
+++ b/CareKitStore/CareKitStore/CoreData/Synchronization/OCKStore+Synchronization.swift
@@ -32,6 +32,7 @@ import CoreData
import Foundation
import os.log
+
extension NSManagedObjectContext {
var clockID: UUID {
@@ -354,6 +355,8 @@ extension OCKStore: OCKRemoteSynchronizationDelegate {
NSSortDescriptor(keyPath: \OCKCDObject.updatedDate, ascending: false)
]
+ request.returnsObjectsAsFaults = false
+
let objects = try context.fetch(request)
let grouped = Dictionary(grouping: objects, by: { $0.knowledgeVector() })
let values = grouped.mapValues({ $0.map { $0.makeValue() } })
@@ -363,6 +366,7 @@ extension OCKStore: OCKRemoteSynchronizationDelegate {
private func findFirstConflict(entity: NSEntityDescription) throws -> [OCKEntity]? {
let request = NSFetchRequest(entityName: entity.name!)
request.predicate = NSPredicate(format: "%K.@count == 0", #keyPath(OCKCDVersionedObject.next))
+ request.returnsObjectsAsFaults = false
let tips = try context.fetch(request)
let grouped = Dictionary(grouping: tips, by: \.id).map(\.1)
@@ -394,3 +398,4 @@ extension OCKStore: OCKRemoteSynchronizationDelegate {
}
}
}
+
diff --git a/CareKitStore/CareKitStore/HealthKit/OCKHealthKitPassthroughStore.swift b/CareKitStore/CareKitStore/HealthKit/OCKHealthKitPassthroughStore.swift
index 7d25fe897..3db3a17c4 100644
--- a/CareKitStore/CareKitStore/HealthKit/OCKHealthKitPassthroughStore.swift
+++ b/CareKitStore/CareKitStore/HealthKit/OCKHealthKitPassthroughStore.swift
@@ -41,13 +41,19 @@ public final class OCKHealthKitPassthroughStore: OCKEventStore {
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var outcomeDelegate: OCKOutcomeStoreDelegate?
+ public weak var outcomeDelegate: OCKOutcomeStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public var taskDelegate: OCKTaskStoreDelegate?
+ public var taskDelegate: OCKTaskStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public var resetDelegate: OCKResetDelegate?
+ public var resetDelegate: OCKResetDelegate? {
+ fatalError("Property is unavailable")
+ }
let store: OCKStore
diff --git a/CareKitStore/CareKitStore/StoreCoordinator/OCKStoreCoordinator.swift b/CareKitStore/CareKitStore/StoreCoordinator/OCKStoreCoordinator.swift
index 08d33afa9..d701770df 100644
--- a/CareKitStore/CareKitStore/StoreCoordinator/OCKStoreCoordinator.swift
+++ b/CareKitStore/CareKitStore/StoreCoordinator/OCKStoreCoordinator.swift
@@ -57,22 +57,34 @@ open class OCKStoreCoordinator: OCKAnyStoreProtocol {
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var patientDelegate: OCKPatientStoreDelegate?
+ public weak var patientDelegate: OCKPatientStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var carePlanDelegate: OCKCarePlanStoreDelegate?
+ public weak var carePlanDelegate: OCKCarePlanStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var contactDelegate: OCKContactStoreDelegate?
+ public weak var contactDelegate: OCKContactStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var taskDelegate: OCKTaskStoreDelegate?
+ public weak var taskDelegate: OCKTaskStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var outcomeDelegate: OCKOutcomeStoreDelegate?
+ public weak var outcomeDelegate: OCKOutcomeStoreDelegate? {
+ fatalError("Property is unavailable")
+ }
@available(*, unavailable, message: "OCKSynchronizedStoreManager and its related types are no longer available as a mechanism to synchronize with the CareKit store. As a replacement, see the asynchronous streams available directly on a CareKit store. For example, to monitor changes to tasks, see `OCKStore.tasks(query:)`.")
- public weak var resetDelegate: OCKResetDelegate?
+ public weak var resetDelegate: OCKResetDelegate? {
+ fatalError("Property is unavailable")
+ }
public init() {}
diff --git a/CareKitStore/CareKitStore/Streaming/CoreDataQueryMonitor.swift b/CareKitStore/CareKitStore/Streaming/CoreDataQueryMonitor.swift
index 1282c9c54..8ff4ba960 100644
--- a/CareKitStore/CareKitStore/Streaming/CoreDataQueryMonitor.swift
+++ b/CareKitStore/CareKitStore/Streaming/CoreDataQueryMonitor.swift
@@ -89,7 +89,7 @@ final class CoreDataQueryMonitor<
}
let result = controller!.fetchedObjects ?? []
- resultHandler(.success(result))
+ self.resultHandler(.success(result))
}
func stopQuery() {
diff --git a/CareKitStore/CareKitStore/Structs/OCKScheduleEvent.swift b/CareKitStore/CareKitStore/Structs/OCKScheduleEvent.swift
index 8157e320a..698dbc98c 100644
--- a/CareKitStore/CareKitStore/Structs/OCKScheduleEvent.swift
+++ b/CareKitStore/CareKitStore/Structs/OCKScheduleEvent.swift
@@ -35,11 +35,4 @@ public struct OCKScheduleEvent: Equatable {
public var end: Date
public var element: OCKScheduleElement
public var occurrence: Int
-
- internal init(start: Date, end: Date, element: OCKScheduleElement, occurrence: Int) {
- self.start = start
- self.end = end
- self.element = element
- self.occurrence = occurrence
- }
}
diff --git a/CareKitStore/CareKitStore/Structs/Queries/OCKAdherenceQuery.swift b/CareKitStore/CareKitStore/Structs/Queries/OCKAdherenceQuery.swift
index 3280363b4..3724bc838 100644
--- a/CareKitStore/CareKitStore/Structs/Queries/OCKAdherenceQuery.swift
+++ b/CareKitStore/CareKitStore/Structs/Queries/OCKAdherenceQuery.swift
@@ -41,7 +41,9 @@ public struct OCKAdherenceQuery {
/// Computes the combined progress for a series of CareKit events.
@available(*, unavailable, message: "The aggregator is no longer available and will be removed in a future version of CareKit.")
- public var aggregator: OCKAdherenceAggregator!
+ public var aggregator: OCKAdherenceAggregator! {
+ fatalError("Property is unavailable")
+ }
let computeProgress: (OCKAnyEvent) -> CareTaskProgress
diff --git a/CareKitStore/CareKitStoreTests/CoreDataSchema/TestCoreDataSchema+Migrations.swift b/CareKitStore/CareKitStoreTests/CoreDataSchema/TestCoreDataSchema+Migrations.swift
index 7279020f6..4a953b053 100644
--- a/CareKitStore/CareKitStoreTests/CoreDataSchema/TestCoreDataSchema+Migrations.swift
+++ b/CareKitStore/CareKitStoreTests/CoreDataSchema/TestCoreDataSchema+Migrations.swift
@@ -92,7 +92,7 @@ class TestCoreDataSchemaMigrations: XCTestCase {
// were setup correctly.
let ckRequest = NSFetchRequest(entityName: "OCKCDTask")
let ckTasks = try container.viewContext.fetch(ckRequest)
- XCTAssert(ckTasks.count == 3)
+ XCTAssertEqual(ckTasks.count, 3)
let ckTask = ckTasks.first
let ckSchedule = ckTask?.value(forKey: "scheduleElements")
@@ -100,8 +100,8 @@ class TestCoreDataSchemaMigrations: XCTestCase {
let ckSchema = ckTask?.value(forKey: "schemaVersion") as? String
XCTAssertNotNil(ckTask)
XCTAssertNotNil(ckSchedule)
- XCTAssertTrue(ckKnowledge?.count == 1)
- XCTAssertTrue(ckSchema == "2.1.0")
+ XCTAssertEqual(ckKnowledge?.count, 1)
+ XCTAssertEqual(ckSchema, "2.1.0")
let outcomes = ckTask?.value(forKey: "outcomes") as? Set
let values = outcomes?.map { $0.value(forKey: "values") as? Set }
diff --git a/CareKitStore/CareKitStoreTests/OCKHealthKitStore/TestHealthKitStore+Tasks.swift b/CareKitStore/CareKitStoreTests/OCKHealthKitStore/TestHealthKitStore+Tasks.swift
index c4e7116fb..34991f5e5 100644
--- a/CareKitStore/CareKitStoreTests/OCKHealthKitStore/TestHealthKitStore+Tasks.swift
+++ b/CareKitStore/CareKitStoreTests/OCKHealthKitStore/TestHealthKitStore+Tasks.swift
@@ -74,7 +74,7 @@ class TestHealthKitStoreTasks: XCTestCase {
task.healthKitLinkage = linkage
task = try store.addTaskAndWait(task)
XCTAssertNotNil(task.healthKitLinkage)
- XCTAssert(task.healthKitLinkage == linkage)
+ XCTAssertEqual(task.healthKitLinkage, linkage)
}
func testAddTaskFailsIfIdentifierAlreadyExists() throws {
@@ -90,7 +90,7 @@ class TestHealthKitStoreTasks: XCTestCase {
var task = OCKHealthKitTask(id: "benadryl", title: "Benadryl", carePlanUUID: nil, schedule: schedule, healthKitLinkage: link)
task = try store.addTaskAndWait(task)
guard let fetchedElement = task.schedule.elements.first else { XCTFail("Bad schedule"); return }
- XCTAssertTrue(fetchedElement.duration == .allDay)
+ XCTAssertEqual(fetchedElement.duration, .allDay)
}
// MARK: Querying
@@ -101,8 +101,8 @@ class TestHealthKitStoreTasks: XCTestCase {
let task2 = OCKHealthKitTask(id: "lunges", title: "Forward Lunges", carePlanUUID: nil, schedule: schedule, healthKitLinkage: link)
try store.addTasksAndWait([task1, task2])
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery(id: task1.id))
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testTaskQueryGroupIdentifier() throws {
@@ -117,8 +117,8 @@ class TestHealthKitStoreTasks: XCTestCase {
query.groupIdentifiers = ["group1"]
let tasks = try store.fetchTasksAndWait(query: query)
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testTaskQueryOrdered() throws {
@@ -135,7 +135,7 @@ class TestHealthKitStoreTasks: XCTestCase {
query.sortDescriptors = [.title(ascending: true)]
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.map { $0.title } == [nil, "aa", "bb"])
+ XCTAssertEqual(fetched.map { $0.title }, [nil, "aa", "bb"])
}
func testTaskQueryLimited() throws {
@@ -151,7 +151,7 @@ class TestHealthKitStoreTasks: XCTestCase {
query.limit = 2
let tasks = try store.fetchTasksAndWait(query: query)
- XCTAssert(tasks.count == 2)
+ XCTAssertEqual(tasks.count, 2)
}
func testTaskQueryTags() throws {
@@ -170,7 +170,7 @@ class TestHealthKitStoreTasks: XCTestCase {
query.sortDescriptors = [.title(ascending: true)]
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.map { $0.title } == ["b", "c"])
+ XCTAssertEqual(fetched.map { $0.title }, ["b", "c"])
}
func testTaskQueryWithNilQueryReturnsAllTasks() throws {
@@ -180,7 +180,7 @@ class TestHealthKitStoreTasks: XCTestCase {
let task3 = OCKHealthKitTask(id: "c", title: "c", carePlanUUID: nil, schedule: schedule, healthKitLinkage: link)
try store.addTasksAndWait([task1, task2, task3])
let tasks = try store.fetchTasksAndWait()
- XCTAssert(tasks.count == 3)
+ XCTAssertEqual(tasks.count, 3)
}
func testQueryTaskByRemoteID() throws {
@@ -193,7 +193,7 @@ class TestHealthKitStoreTasks: XCTestCase {
query.remoteIDs = ["abc"]
let fetched = try store.fetchTasksAndWait(query: query).first
- XCTAssert(fetched == task)
+ XCTAssertEqual(fetched, task)
}
// MARK: Versioning
@@ -204,8 +204,8 @@ class TestHealthKitStoreTasks: XCTestCase {
let task = try store.addTaskAndWait(version1)
let version2 = OCKHealthKitTask(id: "meds", title: "New Medication", carePlanUUID: nil, schedule: schedule, healthKitLinkage: link)
let updatedTask = try store.updateTaskAndWait(version2)
- XCTAssert(updatedTask.title == "New Medication")
- XCTAssert(updatedTask.previousVersionUUIDs.first == task.uuid)
+ XCTAssertEqual(updatedTask.title, "New Medication")
+ XCTAssertEqual(updatedTask.previousVersionUUIDs.first, task.uuid)
}
func testUpdateFailsForUnsavedTasks() {
@@ -227,8 +227,8 @@ class TestHealthKitStoreTasks: XCTestCase {
try store.addTasksAndWait([task1, task2])
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery(for: Date()))
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testTaskQueryOnPastDateReturnsPastVersionOfATask() throws {
@@ -247,8 +247,8 @@ class TestHealthKitStoreTasks: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(-10))
let query = OCKTaskQuery(dateInterval: interval)
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.count == 1, "Expected to get 1 task, but got \(fetched.count)")
- XCTAssert(fetched.first?.title == taskA.title)
+ XCTAssertEqual(fetched.count, 1, "Expected to get 1 task, but got \(fetched.count)")
+ XCTAssertEqual(fetched.first?.title, taskA.title)
}
func testTaskQuerySpanningVersionsReturnsNewestVersionOnly() throws {
@@ -267,8 +267,8 @@ class TestHealthKitStoreTasks: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(10))
let query = OCKTaskQuery(dateInterval: interval)
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.title == taskB.title)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.title, taskB.title)
}
// MARK: Deletion
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+BuildRevisions.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+BuildRevisions.swift
index a418383da..6086933b9 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+BuildRevisions.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+BuildRevisions.swift
@@ -66,7 +66,7 @@ class TestStoreBuildRevisions: XCTestCase {
let revisions = try store.computeRevisions(since: .init())
let entities = revisions.flatMap { $0.entities }
- XCTAssert(entities.count == 2)
+ XCTAssertEqual(entities.count, 2)
}
func testKnownEntitiesAreNotReturned() throws {
@@ -97,9 +97,9 @@ class TestStoreBuildRevisions: XCTestCase {
let knowledge = OCKRevisionRecord.KnowledgeVector([uuid1: 1, uuid2: 3])
let revisions = try store.computeRevisions(since: knowledge)
- XCTAssert(revisions.count == 1)
- XCTAssert(revisions.first?.entities.count == 1)
- XCTAssert(revisions.first?.entities.first?.entityType == .patient)
+ XCTAssertEqual(revisions.count, 1)
+ XCTAssertEqual(revisions.first?.entities.count, 1)
+ XCTAssertEqual(revisions.first?.entities.first?.entityType, .patient)
}
func testEntitiesAreGroupedByKnowledgeVector() throws {
@@ -131,7 +131,7 @@ class TestStoreBuildRevisions: XCTestCase {
let knowledge = OCKRevisionRecord.KnowledgeVector([uuid1: 4])
let revisions = try store.computeRevisions(since: knowledge)
- XCTAssert(revisions.count == 2)
+ XCTAssertEqual(revisions.count, 2)
}
// MARK: Tasks
@@ -142,8 +142,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.addTaskAndWait(task)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 1)
- XCTAssert(revision?.entities.first?.entityType == .task)
+ XCTAssertEqual(revision?.entities.count, 1)
+ XCTAssertEqual(revision?.entities.first?.entityType, .task)
}
func testUpdatingTaskCreatesRevisionRecord() throws {
@@ -156,8 +156,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.updateTaskAndWait(task)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.entityType == .task)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertEqual(revision?.entities.first?.entityType, .task)
}
func testRevisionForDeletingTask() throws {
@@ -172,8 +172,8 @@ class TestStoreBuildRevisions: XCTestCase {
let vector = OCKRevisionRecord.KnowledgeVector([store.context.clockID: 1])
let revision = try store.computeRevisions(since: vector).first
- XCTAssert(revision?.entities.count == 1)
- XCTAssert(revision?.entities.first?.value.deletedDate != nil)
+ XCTAssertEqual(revision?.entities.count, 1)
+ XCTAssertNotNil(revision?.entities.first?.value.deletedDate)
}
// MARK: Outcomes
@@ -187,8 +187,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.addOutcomeAndWait(outcome)
let revision = try store.computeRevisions(since: .init()).first!
- XCTAssert(revision.entities.count == 2)
- XCTAssert(revision.entities.last?.entityType == .outcome)
+ XCTAssertEqual(revision.entities.count, 2)
+ XCTAssertEqual(revision.entities.last?.entityType, .outcome)
}
func testDeletingOutcomeCreatesRevisionRecords() throws {
@@ -201,8 +201,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.deleteOutcomeAndWait(outcome)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.last?.entityType == .outcome)
- XCTAssert(revision?.entities.count == 3)
+ XCTAssertEqual(revision?.entities.last?.entityType, .outcome)
+ XCTAssertEqual(revision?.entities.count, 3)
}
// MARK: Patients
@@ -212,8 +212,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.addPatientAndWait(patient)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 1)
- XCTAssert(revision?.entities.first?.entityType == .patient)
+ XCTAssertEqual(revision?.entities.count, 1)
+ XCTAssertEqual(revision?.entities.first?.entityType, .patient)
}
func testUpdatingPatientCreatesRevisionRecord() throws {
@@ -224,8 +224,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.updatePatientAndWait(patient)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.entityType == .patient)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertEqual(revision?.entities.first?.entityType, .patient)
}
func testRevisionForDeletingPatient() throws {
@@ -235,8 +235,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.deletePatientsAndWait([patient])
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.value.deletedDate != nil)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertNotNil(revision?.entities.first?.value.deletedDate)
}
// MARK: CarePlans
@@ -246,8 +246,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.addCarePlanAndWait(plan)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 1)
- XCTAssert(revision?.entities.first?.entityType == .carePlan)
+ XCTAssertEqual(revision?.entities.count, 1)
+ XCTAssertEqual(revision?.entities.first?.entityType, .carePlan)
}
func testUpdatingCarePlanCreatesRevisionRecord() throws {
@@ -258,8 +258,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.updateCarePlanAndWait(plan)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.entityType == .carePlan)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertEqual(revision?.entities.first?.entityType, .carePlan)
}
func testRevisionForDeletingCarePlan() throws {
@@ -269,8 +269,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.deleteCarePlansAndWait([plan])
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.value.deletedDate != nil)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertNotNil(revision?.entities.first?.value.deletedDate)
}
// MARK: Contact
@@ -280,8 +280,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.addContactAndWait(contact)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 1)
- XCTAssert(revision?.entities.first?.entityType == .contact)
+ XCTAssertEqual(revision?.entities.count, 1)
+ XCTAssertEqual(revision?.entities.first?.entityType, .contact)
}
func testUpdatingContactCreatesRevisionRecord() throws {
@@ -292,8 +292,8 @@ class TestStoreBuildRevisions: XCTestCase {
try store.updateContactAndWait(contact)
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.entityType == .contact)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertEqual(revision?.entities.first?.entityType, .contact)
}
func testRevisionForDeletingContact() throws {
@@ -303,7 +303,7 @@ class TestStoreBuildRevisions: XCTestCase {
try store.deleteContactsAndWait([contact])
let revision = try store.computeRevisions(since: .init()).first
- XCTAssert(revision?.entities.count == 2)
- XCTAssert(revision?.entities.first?.value.deletedDate != nil)
+ XCTAssertEqual(revision?.entities.count, 2)
+ XCTAssertNotNil(revision?.entities.first?.value.deletedDate)
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CRDT.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CRDT.swift
index 7b3fc3f74..612409507 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CRDT.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CRDT.swift
@@ -48,7 +48,7 @@ class TestStoreCRDTMergeProperties: XCTestCase {
}
let patients = try store.fetchPatientsAndWait()
- XCTAssert(patients.count == 1)
+ XCTAssertEqual(patients.count, 1)
}
func testMergeIsCommutative() throws {
@@ -61,7 +61,7 @@ class TestStoreCRDTMergeProperties: XCTestCase {
let patients = try store.fetchPatientsAndWait()
for i in 0..<10 {
- XCTAssert(patients[i].previousVersionUUIDs.isEmpty == (i == 9))
+ XCTAssertEqual(patients[i].previousVersionUUIDs.isEmpty, (i == 9))
}
}
@@ -87,9 +87,9 @@ class TestStoreCRDTMergeProperties: XCTestCase {
let fetchedA = try storeA.fetchPatientsAndWait()
let fetchedB = try storeB.fetchPatientsAndWait()
- XCTAssert(fetchedA.map(\.name) == fetchedB.map(\.name))
- XCTAssert(fetchedA.map(\.previousVersionUUIDs) == fetchedB.map(\.previousVersionUUIDs))
- XCTAssert(fetchedA.map(\.nextVersionUUIDs) == fetchedB.map(\.nextVersionUUIDs))
+ XCTAssertEqual(fetchedA.map(\.name), fetchedB.map(\.name))
+ XCTAssertEqual(fetchedA.map(\.previousVersionUUIDs), fetchedB.map(\.previousVersionUUIDs))
+ XCTAssertEqual(fetchedA.map(\.nextVersionUUIDs), fetchedB.map(\.nextVersionUUIDs))
}
private func makeRevisions(count: Int) -> [OCKRevisionRecord] {
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CarePlans.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CarePlans.swift
index ed0042fc8..4e6a57a80 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CarePlans.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+CarePlans.swift
@@ -63,7 +63,7 @@ class TestStoreCarePlans: XCTestCase {
query.patientIDs = [patient.id]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched == [plan])
+ XCTAssertEqual(fetched, [plan])
}
func testCarePlanQueryGroupIdentifier() throws {
@@ -79,8 +79,8 @@ class TestStoreCarePlans: XCTestCase {
query.groupIdentifiers = ["1"]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.id == "id_1")
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.id, "id_1")
}
func testCarePlanQueryNilGroupIdentifier() throws {
@@ -96,8 +96,8 @@ class TestStoreCarePlans: XCTestCase {
query.groupIdentifiers = [nil]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.id == "id_1")
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.id, "id_1")
}
func testCarePlanQueryLimit() throws {
@@ -107,7 +107,7 @@ class TestStoreCarePlans: XCTestCase {
var query = OCKCarePlanQuery(for: Date())
query.limit = 1
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
+ XCTAssertEqual(fetched.count, 1)
}
func testCarePlanQuerySortedOffset() throws {
@@ -119,8 +119,8 @@ class TestStoreCarePlans: XCTestCase {
query.sortDescriptors = [.title(ascending: true)]
query.offset = 2
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.id == "C")
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.id, "C")
}
func testCarePlanQueryWithNilQueryReturnsAllCarePlans() throws {
@@ -129,7 +129,7 @@ class TestStoreCarePlans: XCTestCase {
let plan3 = OCKCarePlan(id: "3", title: "3", patientUUID: nil)
try store.addCarePlansAndWait([plan1, plan2, plan3])
let plans = try store.fetchCarePlansAndWait()
- XCTAssert(plans.count == 3)
+ XCTAssertEqual(plans.count, 3)
}
func testCarePlanQueryTags() throws {
@@ -149,7 +149,7 @@ class TestStoreCarePlans: XCTestCase {
query.sortDescriptors = [.title(ascending: true)]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.map { $0.title } == ["A", "B"])
+ XCTAssertEqual(fetched.map { $0.title }, ["A", "B"])
}
func testCarePlanQueryByRemoteID() throws {
@@ -165,8 +165,8 @@ class TestStoreCarePlans: XCTestCase {
query.remoteIDs = ["abc"]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first == plan1)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first, plan1)
}
func testCarePlanQueryByNilRemoteID() throws {
@@ -182,8 +182,8 @@ class TestStoreCarePlans: XCTestCase {
query.remoteIDs = [nil]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first == plan1)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first, plan1)
}
func testCarePlaneQueryByPatientUUID() throws {
@@ -194,7 +194,7 @@ class TestStoreCarePlans: XCTestCase {
query.patientUUIDs = [patient.uuid]
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched == [plan])
+ XCTAssertEqual(fetched, [plan])
}
// MARK: Versioning
@@ -202,8 +202,8 @@ class TestStoreCarePlans: XCTestCase {
func testUpdateCarePlanCreatesNewVersion() throws {
let plan = try store.addCarePlanAndWait(OCKCarePlan(id: "bronchitis", title: "Bronchitis", patientUUID: nil))
let updatedPlan = try store.updateCarePlanAndWait(OCKCarePlan(id: "bronchitis", title: "Bronchitis Treatment", patientUUID: nil))
- XCTAssert(updatedPlan.title == "Bronchitis Treatment")
- XCTAssert(updatedPlan.previousVersionUUIDs.first == plan.uuid)
+ XCTAssertEqual(updatedPlan.title, "Bronchitis Treatment")
+ XCTAssertEqual(updatedPlan.previousVersionUUIDs.first, plan.uuid)
}
func testUpdateFailsForUnsavedCarePlans() {
@@ -215,8 +215,8 @@ class TestStoreCarePlans: XCTestCase {
let versionA = try store.addCarePlanAndWait(OCKCarePlan(id: "A", title: "Amy", patientUUID: nil))
let versionB = try store.updateCarePlanAndWait(OCKCarePlan(id: "A", title: "Jared", patientUUID: nil))
let fetched = try store.fetchCarePlanAndWait(id: versionA.id)
- XCTAssert(fetched?.id == versionB.id)
- XCTAssert(fetched?.previousVersionUUIDs.first == versionA.uuid)
+ XCTAssertEqual(fetched?.id, versionB.id)
+ XCTAssertEqual(fetched?.previousVersionUUIDs.first, versionA.uuid)
}
func testCarePlanQueryOnPastDateReturnsPastVersionOfACarePlan() throws {
@@ -233,8 +233,8 @@ class TestStoreCarePlans: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(-10))
let query = OCKCarePlanQuery(dateInterval: interval)
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.title == versionA.title)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.title, versionA.title)
}
func testCarePlanQuerySpanningVersionsReturnsNewestVersionOnly() throws {
@@ -251,8 +251,8 @@ class TestStoreCarePlans: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(10))
let query = OCKCarePlanQuery(dateInterval: interval)
let fetched = try store.fetchCarePlansAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.title == versionB.title)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.title, versionB.title)
}
func testCarePlanQueryBeforeCarePlansWasCreatedReturnsNoResults() throws {
@@ -271,7 +271,7 @@ class TestStoreCarePlans: XCTestCase {
var query = OCKCarePlanQuery(for: Date())
query.remoteIDs = ["abc"]
let fetched = try store.fetchCarePlansAndWait(query: query).first
- XCTAssert(plan == fetched)
+ XCTAssertEqual(plan, fetched)
}
func testQueryCarePlanByPatientRemoteID() throws {
@@ -286,7 +286,7 @@ class TestStoreCarePlans: XCTestCase {
query.patientRemoteIDs = ["abc"]
let fetched = try store.fetchCarePlansAndWait(query: query).first
- XCTAssert(fetched == plan)
+ XCTAssertEqual(fetched, plan)
}
// MARK: Deletion
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ConsumeRevisions.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ConsumeRevisions.swift
index e3371fe60..3cfdb1978 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ConsumeRevisions.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ConsumeRevisions.swift
@@ -58,8 +58,8 @@ class TestStoreConsumeRevisions: XCTestCase {
let tasks = try store.fetchTasksAndWait()
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == "a")
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, "a")
}
func testUpdatingLatestVersionOfTaskViaRevisionRecord() throws {
@@ -81,9 +81,9 @@ class TestStoreConsumeRevisions: XCTestCase {
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery(for: taskB.effectiveDate))
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == "abc123")
- XCTAssert(tasks.first?.title == "B")
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, "abc123")
+ XCTAssertEqual(tasks.first?.title, "B")
}
func testTasksAddedViaRevisionRecordHaveSameCreatedDateAsRevisionRecord() throws {
@@ -101,7 +101,7 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let tasks = try store.fetchTasksAndWait()
- XCTAssert(tasks.first?.createdDate == date)
+ XCTAssertEqual(tasks.first?.createdDate, date)
}
// MARK: Outcomes
@@ -122,8 +122,8 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let outcomes = try store.fetchOutcomesAndWait()
- XCTAssert(outcomes.count == 1)
- XCTAssert(outcomes.first?.id == outcome.id)
+ XCTAssertEqual(outcomes.count, 1)
+ XCTAssertEqual(outcomes.first?.id, outcome.id)
}
func testDeleteExistingOutcomeViaRevisionRecord() throws {
@@ -182,7 +182,7 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let outcomes = try store.fetchOutcomesAndWait()
- XCTAssert(outcomes.first?.createdDate == date)
+ XCTAssertEqual(outcomes.first?.createdDate, date)
}
func testTombstonesAddedViaRevisionRecordedHaveSameUUIDAsRevisionRecord() throws {
@@ -207,9 +207,9 @@ class TestStoreConsumeRevisions: XCTestCase {
expect(with: store.context) {
let request = NSFetchRequest(entityName: "OCKCDOutcome")
let outcome = try self.store.context.fetch(request).first
- XCTAssert(outcome?.createdDate == tombstone.createdDate)
- XCTAssert(outcome?.deletedDate == tombstone.createdDate)
- XCTAssert(outcome?.uuid == tombstone.uuid)
+ XCTAssertEqual(outcome?.createdDate, tombstone.createdDate)
+ XCTAssertEqual(outcome?.deletedDate, tombstone.createdDate)
+ XCTAssertEqual(outcome?.uuid, tombstone.uuid)
}
}
@@ -229,8 +229,8 @@ class TestStoreConsumeRevisions: XCTestCase {
let patients = try store.fetchPatientsAndWait()
- XCTAssert(patients.count == 1)
- XCTAssert(patients.first?.id == "id1")
+ XCTAssertEqual(patients.count, 1)
+ XCTAssertEqual(patients.first?.id, "id1")
}
func testUpdatingLatestVersionOfPatientViaRevisionRecord() throws {
@@ -251,9 +251,9 @@ class TestStoreConsumeRevisions: XCTestCase {
let patients = try store.fetchPatientsAndWait(query: OCKPatientQuery(for: patientB.effectiveDate))
- XCTAssert(patients.count == 1)
- XCTAssert(patients.first?.id == "id1")
- XCTAssert(patients.first?.name.familyName == "Frosty")
+ XCTAssertEqual(patients.count, 1)
+ XCTAssertEqual(patients.first?.id, "id1")
+ XCTAssertEqual(patients.first?.name.familyName, "Frosty")
}
func testPatientsAddedViaRevisionRecordHaveSameCreatedDateAsRevisionRecord() throws {
@@ -270,7 +270,7 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let patients = try store.fetchPatientsAndWait()
- XCTAssert(patients.first?.createdDate == date)
+ XCTAssertEqual(patients.first?.createdDate, date)
}
// MARK: CarePlans
@@ -289,8 +289,8 @@ class TestStoreConsumeRevisions: XCTestCase {
let carePlans = try store.fetchCarePlansAndWait()
- XCTAssert(carePlans.count == 1)
- XCTAssert(carePlans.first?.id == "diabetes_type_1")
+ XCTAssertEqual(carePlans.count, 1)
+ XCTAssertEqual(carePlans.first?.id, "diabetes_type_1")
}
func testUpdatingLatestVersionOfCarePlanViaRevisionRecord() throws {
@@ -311,9 +311,9 @@ class TestStoreConsumeRevisions: XCTestCase {
let carePlans = try store.fetchCarePlansAndWait(query: OCKCarePlanQuery(for: carePlanB.effectiveDate))
- XCTAssert(carePlans.count == 1)
- XCTAssert(carePlans.first?.id == "diabetes_type_1")
- XCTAssert(carePlans.first?.title == "Diabetes Type II Care Plan")
+ XCTAssertEqual(carePlans.count, 1)
+ XCTAssertEqual(carePlans.first?.id, "diabetes_type_1")
+ XCTAssertEqual(carePlans.first?.title, "Diabetes Type II Care Plan")
}
func testCarePlansAddedViaRevisionRecordHaveSameCreatedDateAsRevisionRecord() throws {
@@ -330,7 +330,7 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let carePlans = try store.fetchCarePlansAndWait()
- XCTAssert(carePlans.first?.createdDate == date)
+ XCTAssertEqual(carePlans.first?.createdDate, date)
}
// MARK: Contacts
@@ -349,8 +349,8 @@ class TestStoreConsumeRevisions: XCTestCase {
let contacts = try store.fetchContactsAndWait()
- XCTAssert(contacts.count == 1)
- XCTAssert(contacts.first?.id == "contact")
+ XCTAssertEqual(contacts.count, 1)
+ XCTAssertEqual(contacts.first?.id, "contact")
}
func testUpdatingLatestVersionOfContactViaRevisionRecord() throws {
@@ -371,9 +371,9 @@ class TestStoreConsumeRevisions: XCTestCase {
let contacts = try store.fetchContactsAndWait(query: OCKContactQuery(for: contactB.effectiveDate))
- XCTAssert(contacts.count == 1)
- XCTAssert(contacts.first?.id == "contact")
- XCTAssert(contacts.first?.name.familyName == "Frosty")
+ XCTAssertEqual(contacts.count, 1)
+ XCTAssertEqual(contacts.first?.id, "contact")
+ XCTAssertEqual(contacts.first?.name.familyName, "Frosty")
}
func testContactsAddedViaRevisionRecordHaveSameCreatedDateAsRevisionRecord() throws {
@@ -390,7 +390,7 @@ class TestStoreConsumeRevisions: XCTestCase {
store.mergeRevision(revision)
let contacts = try store.fetchContactsAndWait()
- XCTAssert(contacts.first?.createdDate == date)
+ XCTAssertEqual(contacts.first?.createdDate, date)
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Contacts.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Contacts.swift
index 234f2fe7d..7f09a3c81 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Contacts.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Contacts.swift
@@ -58,17 +58,17 @@ class TestStoreContacts: XCTestCase {
contact = try store.addContactAndWait(contact)
let fetchedConctacts = try store.fetchContactsAndWait()
- XCTAssert([contact] == fetchedConctacts)
- XCTAssert(contact.address?.state == "CO")
- XCTAssert(contact.address?.country == "US")
- XCTAssert(contact.address?.street == "4693 Sweetwood Drive")
- XCTAssert(contact.messagingNumbers == [OCKLabeledValue(label: "iPhone", value: "303-555-0194")])
- XCTAssert(contact.phoneNumbers == [OCKLabeledValue(label: "Home", value: "303-555-0108")])
- XCTAssert(contact.emailAddresses == [OCKLabeledValue(label: "Email", value: "amy_frost44@icloud.com")])
- XCTAssert(contact.otherContactInfo == [OCKLabeledValue(label: "Facetime", value: "303-555-0121")])
- XCTAssert(contact.organization == "Apple Dumplings Corp.")
- XCTAssert(contact.title == "Manager of Apple Peeling")
- XCTAssert(contact.role == "Official Taste Tester")
+ XCTAssertEqual([contact], fetchedConctacts)
+ XCTAssertEqual(contact.address?.state, "CO")
+ XCTAssertEqual(contact.address?.country, "US")
+ XCTAssertEqual(contact.address?.street, "4693 Sweetwood Drive")
+ XCTAssertEqual(contact.messagingNumbers, [OCKLabeledValue(label: "iPhone", value: "303-555-0194")])
+ XCTAssertEqual(contact.phoneNumbers, [OCKLabeledValue(label: "Home", value: "303-555-0108")])
+ XCTAssertEqual(contact.emailAddresses, [OCKLabeledValue(label: "Email", value: "amy_frost44@icloud.com")])
+ XCTAssertEqual(contact.otherContactInfo, [OCKLabeledValue(label: "Facetime", value: "303-555-0121")])
+ XCTAssertEqual(contact.organization, "Apple Dumplings Corp.")
+ XCTAssertEqual(contact.title, "Manager of Apple Peeling")
+ XCTAssertEqual(contact.role, "Official Taste Tester")
XCTAssertNotNil(contact.schemaVersion)
XCTAssertNotNil(contact.uuid)
}
@@ -86,7 +86,7 @@ class TestStoreContacts: XCTestCase {
let contact1 = try store.addContactAndWait(OCKContact(id: "contact1", givenName: "Amy", familyName: "Frost", carePlanUUID: nil))
try store.addContactAndWait(OCKContact(id: "contact2", givenName: "Amy", familyName: "Frost", carePlanUUID: nil))
let fetchedContacts = try store.fetchContactsAndWait(query: OCKContactQuery(id: "contact1"))
- XCTAssert(fetchedContacts == [contact1])
+ XCTAssertEqual(fetchedContacts, [contact1])
}
func testQueryContactsByCarePlanID() throws {
@@ -97,7 +97,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery()
query.carePlanIDs = [carePlan.id]
let fetchedContacts = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetchedContacts == [contact])
+ XCTAssertEqual(fetchedContacts, [contact])
}
func testContactsQueryGroupIdentifiers() throws {
@@ -109,8 +109,8 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.groupIdentifiers = ["Alpha"]
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.groupIdentifier == "Alpha")
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.groupIdentifier, "Alpha")
}
func testContactQueryTags() throws {
@@ -124,7 +124,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.tags = ["C"]
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.map { $0.id }.sorted() == ["B", "C"])
+ XCTAssertEqual(fetched.map { $0.id }.sorted(), ["B", "C"])
}
func testContactQueryLimited() throws {
@@ -135,7 +135,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.limit = 2
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.count == 2)
+ XCTAssertEqual(fetched.count, 2)
}
func testContactQueryOffset() throws {
@@ -146,7 +146,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.offset = 2
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.count == 1)
+ XCTAssertEqual(fetched.count, 1)
}
func testContactQuerySorted() throws {
@@ -157,7 +157,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.sortDescriptors = [.givenName(ascending: true)]
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.map { $0.name.givenName } == ["a", "b", "c"])
+ XCTAssertEqual(fetched.map { $0.name.givenName }, ["a", "b", "c"])
}
func testContactNilQueryReturnsAllContacts() throws {
@@ -166,7 +166,7 @@ class TestStoreContacts: XCTestCase {
let contactC = OCKContact(id: "C", givenName: "c", familyName: "cccc", carePlanUUID: nil)
try store.addContactsAndWait([contactA, contactB, contactC])
let contacts = try store.fetchContactsAndWait()
- XCTAssertNotNil(contacts.count == 3)
+ XCTAssertEqual(contacts.count, 3)
}
func testQueryContactByRemoteID() throws {
@@ -176,7 +176,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery()
query.remoteIDs = ["abc"]
let fetched = try store.fetchContactsAndWait(query: query).first
- XCTAssert(fetched == contact)
+ XCTAssertEqual(fetched, contact)
}
func testQueryContactByCarePlanRemoteID() throws {
@@ -189,7 +189,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.carePlanRemoteIDs = ["abc"]
let fetched = try store.fetchContactsAndWait(query: query).first
- XCTAssert(fetched == contact)
+ XCTAssertEqual(fetched, contact)
}
func testQueryContactByCarePlanVersionID() throws {
@@ -198,7 +198,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery(for: Date())
query.carePlanUUIDs = [plan.uuid]
let fetched = try store.fetchContactsAndWait(query: query).first
- XCTAssert(fetched == contact)
+ XCTAssertEqual(fetched, contact)
}
func testQueryContactByUUID() throws {
@@ -207,7 +207,7 @@ class TestStoreContacts: XCTestCase {
var query = OCKContactQuery()
query.uuids = [contact.uuid]
let fetched = try store.fetchContactsAndWait(query: query).first
- XCTAssert(fetched == contact)
+ XCTAssertEqual(fetched, contact)
}
// MARK: Versioning
@@ -215,9 +215,9 @@ class TestStoreContacts: XCTestCase {
func testUpdateContactCreatesNewVersion() throws {
let contact = try store.addContactAndWait(OCKContact(id: "contact", givenName: "John", familyName: "Appleseed", carePlanUUID: nil))
let updated = try store.updateContactAndWait(OCKContact(id: "contact", givenName: "Jane", familyName: "Appleseed", carePlanUUID: nil))
- XCTAssert(updated.name.givenName == "Jane")
- XCTAssert(updated.uuid != contact.uuid)
- XCTAssert(updated.previousVersionUUIDs.first == contact.uuid)
+ XCTAssertEqual(updated.name.givenName, "Jane")
+ XCTAssertNotEqual(updated.uuid, contact.uuid)
+ XCTAssertEqual(updated.previousVersionUUIDs.first, contact.uuid)
}
func testUpdateFailsForUnsavedContacts() {
@@ -231,8 +231,8 @@ class TestStoreContacts: XCTestCase {
try store.updateContactAndWait(OCKContact(id: "contact", givenName: "C", familyName: "", carePlanUUID: nil))
let versionD = try store.updateContactAndWait(OCKContact(id: "contact", givenName: "D", familyName: "", carePlanUUID: nil))
let fetched = try store.fetchContactAndWait(id: "contact")
- XCTAssert(fetched?.id == versionD.id)
- XCTAssert(fetched?.name == versionD.name)
+ XCTAssertEqual(fetched?.id, versionD.id)
+ XCTAssertEqual(fetched?.name, versionD.name)
}
func testContactQueryWithDateOnlyReturnsLatestVersionOfAContact() throws {
@@ -241,8 +241,8 @@ class TestStoreContacts: XCTestCase {
try store.updateContactAndWait(OCKContact(id: "contact", givenName: "C", familyName: "", carePlanUUID: nil))
try store.updateContactAndWait(OCKContact(id: "contact", givenName: "D", familyName: "", carePlanUUID: nil))
let fetched = try store.fetchContactsAndWait(query: OCKContactQuery(for: Date()))
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.name.givenName == "D")
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.name.givenName, "D")
}
func testContactQueryWithNoDateReturnsAllVersionsOfAContact() throws {
@@ -251,7 +251,7 @@ class TestStoreContacts: XCTestCase {
try store.updateContactAndWait(OCKContact(id: "contact", givenName: "C", familyName: "", carePlanUUID: nil))
try store.updateContactAndWait(OCKContact(id: "contact", givenName: "D", familyName: "", carePlanUUID: nil))
let fetched = try store.fetchContactsAndWait(query: OCKContactQuery())
- XCTAssert(fetched.count == 4)
+ XCTAssertEqual(fetched.count, 4)
}
func testContactQueryOnPastDateReturnsPastVersionOfAContact() throws {
@@ -268,8 +268,8 @@ class TestStoreContacts: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(-10))
let query = OCKContactQuery(dateInterval: interval)
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.name == versionA.name)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.name, versionA.name)
}
func testContactQuerySpanningVersionsReturnsNewestVersionOnly() throws {
@@ -287,8 +287,8 @@ class TestStoreContacts: XCTestCase {
let query = OCKContactQuery(dateInterval: interval)
let fetched = try store.fetchContactsAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.name == versionB.name)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.name, versionB.name)
}
func testContactQueryBeforeContactWasCreatedReturnsNoResults() throws {
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Notes.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Notes.swift
index 20101ada3..c90c8db17 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Notes.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Notes.swift
@@ -43,14 +43,14 @@ class TestStoreNotes: XCTestCase {
var patient = OCKPatient(id: "Mr. John", givenName: "John", familyName: "Appleseed")
patient.notes = [OCKNote(author: "Johnny", title: "My Diary", content: "Today I studied biochemistry!")]
let savedPatient = try store.addPatientAndWait(patient)
- XCTAssert(savedPatient.notes?.count == 1)
+ XCTAssertEqual(savedPatient.notes?.count, 1)
}
func testCanAttachNotesToCarePlan() throws {
var plan = OCKCarePlan(id: "obesity", title: "Obesity", patientUUID: nil)
plan.notes = [OCKNote(author: "Mariana", title: "Refrigerator Notes", content: "Butter, milk, eggs")]
let savedPlan = try store.addCarePlanAndWait(plan)
- XCTAssert(savedPlan.notes?.count == 1)
+ XCTAssertEqual(savedPlan.notes?.count, 1)
}
func testCanAttachNotesToTask() throws {
@@ -58,7 +58,7 @@ class TestStoreNotes: XCTestCase {
var task = OCKTask(id: "id123", title: "prayer", carePlanUUID: nil, schedule: schedule)
task.notes = [OCKNote(author: "Jared", title: "Note", content: "Made some remarks")]
let savedTask = try store.addTaskAndWait(task)
- XCTAssert(savedTask.notes?.count == 1)
+ XCTAssertEqual(savedTask.notes?.count, 1)
}
func testCanAttachNotesToOutcome() throws {
@@ -67,6 +67,6 @@ class TestStoreNotes: XCTestCase {
var outcome = OCKOutcome(taskUUID: task.uuid, taskOccurrenceIndex: 0, values: [])
outcome.notes = [OCKNote(author: "Jared", title: "My Recipe", content: "Bacon, eggs, and cheese")]
let savedOutcome = try store.addOutcomeAndWait(outcome)
- XCTAssert(savedOutcome.notes?.count == 1)
+ XCTAssertEqual(savedOutcome.notes?.count, 1)
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Outcomes.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Outcomes.swift
index ff433440d..672167594 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Outcomes.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Outcomes.swift
@@ -63,8 +63,8 @@ class TestStoreOutcomes: XCTestCase {
outcome = try store.addOutcomeAndWait(outcome)
let outcomes = try store.fetchOutcomesAndWait()
- XCTAssert(outcomes == [outcome])
- XCTAssert(outcomes.first?.values.first?.kind == "number")
+ XCTAssertEqual(outcomes, [outcome])
+ XCTAssertEqual(outcomes.first?.values.first?.kind, "number")
XCTAssertNotNil(outcomes.first?.taskUUID)
XCTAssertNotNil(outcomes.first?.schemaVersion)
}
@@ -76,7 +76,7 @@ class TestStoreOutcomes: XCTestCase {
var outcome = OCKOutcome(taskUUID: taskUUID, taskOccurrenceIndex: 2, values: [])
outcome = try store.addOutcomeAndWait(outcome)
- XCTAssert(outcome.taskUUID == taskUUID)
+ XCTAssertEqual(outcome.taskUUID, taskUUID)
}
func testCannotAddTwoOutcomesWithSameTaskAndOccurrenceIndexAtOnce() throws {
@@ -121,7 +121,7 @@ class TestStoreOutcomes: XCTestCase {
let taskV2 = try store.updateTaskAndWait(task)
let value = OCKOutcomeValue(123)
let outcome = OCKOutcome(taskUUID: taskV1.uuid, taskOccurrenceIndex: 1, values: [value])
- XCTAssert(taskV2.previousVersionUUIDs.first == taskV1.uuid)
+ XCTAssertEqual(taskV2.previousVersionUUIDs.first, taskV1.uuid)
XCTAssertThrowsError(try store.addOutcomeAndWait(outcome))
}
@@ -179,8 +179,8 @@ class TestStoreOutcomes: XCTestCase {
var query = OCKOutcomeQuery(for: Date())
query.groupIdentifiers = ["A"]
let fetched = try store.fetchOutcomesAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.taskOccurrenceIndex == 0)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.taskOccurrenceIndex, 0)
}
func testQueryReturnsOnlyOutcomesInTheQueryDateRange() throws {
@@ -197,7 +197,7 @@ class TestStoreOutcomes: XCTestCase {
var query = OCKOutcomeQuery(dateInterval: interval)
query.taskIDs = [task.id]
let outcomes = try store.fetchOutcomesAndWait(query: query)
- XCTAssert(outcomes.count == 1)
+ XCTAssertEqual(outcomes.count, 1)
XCTAssertTrue(outcomes.contains(outcome1))
XCTAssertFalse(outcomes.contains(outcome2))
}
@@ -222,7 +222,7 @@ class TestStoreOutcomes: XCTestCase {
let query = OCKOutcomeQuery(for: queryStart)
let fetched = try store.fetchOutcomesAndWait(query: query)
- XCTAssert(fetched.count == 1)
+ XCTAssertEqual(fetched.count, 1)
}
func testOutcomeQueryLimit() throws {
@@ -236,7 +236,7 @@ class TestStoreOutcomes: XCTestCase {
var query = OCKOutcomeQuery(for: Date())
query.limit = 1
let fetched = try store.fetchOutcomesAndWait(query: query)
- XCTAssert(fetched.count == 1)
+ XCTAssertEqual(fetched.count, 1)
}
func testQueryOutcomesByRemoteID() throws {
@@ -252,7 +252,7 @@ class TestStoreOutcomes: XCTestCase {
query.remoteIDs = ["abc"]
let fetched = try store.fetchOutcomesAndWait(query: query).first
- XCTAssert(fetched == outcome)
+ XCTAssertEqual(fetched, outcome)
}
func testQueryOutcomeByTaskRemoteID() throws {
@@ -266,7 +266,7 @@ class TestStoreOutcomes: XCTestCase {
var query = OCKOutcomeQuery(for: Date())
query.taskRemoteIDs = ["abc"]
let fetched = try store.fetchOutcomesAndWait(query: query).first
- XCTAssert(fetched == outcome)
+ XCTAssertEqual(fetched, outcome)
}
func testQueryOutcomeByTag() throws {
@@ -281,7 +281,7 @@ class TestStoreOutcomes: XCTestCase {
query.tags = ["123"]
let fetched = try store.fetchOutcomesAndWait(query: query).first
- XCTAssert(fetched == outcome)
+ XCTAssertEqual(fetched, outcome)
}
func testQueryOutcomeByUUID() throws {
@@ -295,7 +295,7 @@ class TestStoreOutcomes: XCTestCase {
query.uuids = [outcome.uuid]
let fetched = try store.fetchOutcomesAndWait(query: query).first
- XCTAssert(fetched == outcome)
+ XCTAssertEqual(fetched, outcome)
}
func testFetchOutcomeReturnsLatestVersionEffectiveAfterPreviousVersion() async throws {
@@ -442,7 +442,7 @@ class TestStoreOutcomes: XCTestCase {
let outcomeA = try store.addOutcomeAndWait(OCKOutcome(taskUUID: taskUUID, taskOccurrenceIndex: 0, values: []))
let outcomeB = try store.updateOutcomeAndWait(outcomeA)
- XCTAssert(outcomeB.id == outcomeA.id)
+ XCTAssertEqual(outcomeB.id, outcomeA.id)
}
func testUpdateFailsForUnsavedOutcomes() throws {
@@ -504,8 +504,8 @@ class TestStoreOutcomes: XCTestCase {
let query = OCKOutcomeQuery(for: Date())
let fetched = try store.fetchOutcomesAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.values.first?.integerValue == 5)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.values.first?.integerValue, 5)
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Patients.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Patients.swift
index b5f673424..939dd2d69 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Patients.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Patients.swift
@@ -114,7 +114,7 @@ class TestStorePatients: XCTestCase {
let patientF = OCKPatient(id: "F", givenName: "Mariana", familyName: "Lin")
try store.addPatientsAndWait([patientA, patientB, patientC, patientD, patientE, patientF])
let patients = try store.fetchPatientsAndWait(query: OCKPatientQuery())
- XCTAssert(patients.count == 6)
+ XCTAssertEqual(patients.count, 6)
}
func testQueryPatientByRemoteID() throws {
@@ -124,7 +124,7 @@ class TestStorePatients: XCTestCase {
var query = OCKPatientQuery(for: Date())
query.remoteIDs = ["abc"]
let fetched = try store.fetchPatientsAndWait(query: query).first
- XCTAssert(fetched == patient)
+ XCTAssertEqual(fetched, patient)
}
func testBiologicalSexIsPersistedCorrectly() throws {
@@ -132,7 +132,7 @@ class TestStorePatients: XCTestCase {
patient.sex = .female
patient = try store.addPatientAndWait(patient)
patient = try store.fetchPatientAndWait(id: "A")
- XCTAssert(patient.sex == .female)
+ XCTAssertEqual(patient.sex, .female)
}
func testBirthdayIsPersistedCorrectly() throws {
@@ -141,7 +141,7 @@ class TestStorePatients: XCTestCase {
patient.birthday = now
patient = try store.addPatientAndWait(patient)
patient = try store.fetchPatientAndWait(id: "A")
- XCTAssert(patient.birthday == now)
+ XCTAssertEqual(patient.birthday, now)
}
func testAllergiesArePersistedCorrectly() throws {
@@ -149,7 +149,7 @@ class TestStorePatients: XCTestCase {
patient.allergies = ["A", "B", "C"]
patient = try store.addPatientAndWait(patient)
patient = try store.fetchPatientAndWait(id: "A")
- XCTAssert(patient.allergies == ["A", "B", "C"])
+ XCTAssertEqual(patient.allergies, ["A", "B", "C"])
}
// MARK: Versioning
@@ -157,8 +157,8 @@ class TestStorePatients: XCTestCase {
func testUpdatePatientCreatesNewVersion() throws {
let patient = try store.addPatientAndWait(OCKPatient(id: "myID", givenName: "Chris", familyName: "Saari"))
let updatedPatient = try store.updatePatientAndWait(OCKPatient(id: "myID", givenName: "Chris", familyName: "Sillers"))
- XCTAssert(updatedPatient.name.familyName == "Sillers")
- XCTAssert(updatedPatient.previousVersionUUIDs.first == patient.uuid)
+ XCTAssertEqual(updatedPatient.name.familyName, "Sillers")
+ XCTAssertEqual(updatedPatient.previousVersionUUIDs.first, patient.uuid)
}
func testUpdateFailsForUnsavedPatient() {
@@ -169,7 +169,7 @@ class TestStorePatients: XCTestCase {
let versionA = try store.addPatientAndWait(OCKPatient(id: "A", givenName: "Jared", familyName: "Gosler"))
let versionB = try store.updatePatientAndWait(OCKPatient(id: "A", givenName: "John", familyName: "Appleseed"))
let fetched = try store.fetchPatientAndWait(id: versionA.id)
- XCTAssert(fetched == versionB)
+ XCTAssertEqual(fetched, versionB)
}
func testPatientQueryOnPastDateReturnsPastVersionOfAPatient() throws {
@@ -188,8 +188,8 @@ class TestStorePatients: XCTestCase {
query.ids = ["A"]
let fetched = try store.fetchPatientsAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.name == versionA.name)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.name, versionA.name)
}
func testPatientQuerySpanningVersionsReturnsNewestVersionOnly() throws {
@@ -208,8 +208,8 @@ class TestStorePatients: XCTestCase {
query.ids = ["A"]
let fetched = try store.fetchPatientsAndWait(query: query)
- XCTAssert(fetched.count == 1)
- XCTAssert(fetched.first?.name == versionB.name)
+ XCTAssertEqual(fetched.count, 1)
+ XCTAssertEqual(fetched.first?.name, versionB.name)
}
func testPatientQueryBeforePatientWasCreatedReturnsNoResults() throws {
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ResolveConflicts.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ResolveConflicts.swift
index 57b43f40b..357e25230 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ResolveConflicts.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+ResolveConflicts.swift
@@ -57,7 +57,7 @@ class TestStoreResolveConflicts: XCTestCase {
store.mergeRevision(revision)
try store.resolveConflictsAndWait()
- XCTAssert(timesCalled == 2)
+ XCTAssertEqual(timesCalled, 2)
}
func testResolveConflictCanBeCalledWithMoreThanTwoConflicts() throws {
@@ -74,7 +74,7 @@ class TestStoreResolveConflicts: XCTestCase {
let revision = OCKRevisionRecord(entities: entities, knowledgeVector: vector)
remote.resolveConflict = { conflicts in
- XCTAssert(conflicts.count == 10)
+ XCTAssertEqual(conflicts.count, 10)
return conflicts.first!
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Sync.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Sync.swift
index 6ee142814..4dc8fe4a6 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Sync.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Sync.swift
@@ -50,8 +50,8 @@ final class TestStoreSynchronization: XCTestCase {
let startKnowledgeA = OCKRevisionRecord.KnowledgeVector([uuidA: 1])
let startKnowledgeB = OCKRevisionRecord.KnowledgeVector([uuidB: 1])
- XCTAssert(startKnowledgeA == storeA.context.knowledgeVector)
- XCTAssert(startKnowledgeB == storeB.context.knowledgeVector)
+ XCTAssertEqual(startKnowledgeA, storeA.context.knowledgeVector)
+ XCTAssertEqual(startKnowledgeB, storeB.context.knowledgeVector)
XCTAssert(server.revisions.isEmpty)
// 2. Sync the first version of a task from A to B.
@@ -79,12 +79,12 @@ final class TestStoreSynchronization: XCTestCase {
uuidB: 2 // Received from B during push
])
- XCTAssert(firstTasksA.count == 1, "Expected 1, got \(firstTasksA.count)")
- XCTAssert(firstTasksB.count == 1, "Expected 1, got \(firstTasksB.count)")
- XCTAssert(firstKnowledgeA == storeA.context.knowledgeVector)
- XCTAssert(firstKnowledgeB == storeB.context.knowledgeVector)
- XCTAssert(firstServerKnowledge == server.knowledgeVector)
- XCTAssert(server.revisions.count == 1)
+ XCTAssertEqual(firstTasksA.count, 1, "Expected 1, got \(firstTasksA.count)")
+ XCTAssertEqual(firstTasksB.count, 1, "Expected 1, got \(firstTasksB.count)")
+ XCTAssertEqual(firstKnowledgeA, storeA.context.knowledgeVector)
+ XCTAssertEqual(firstKnowledgeB, storeB.context.knowledgeVector)
+ XCTAssertEqual(firstServerKnowledge, server.knowledgeVector)
+ XCTAssertEqual(server.revisions.count, 1)
// 2. Create conflicting updates in both stores.
// Neither store will have a conflict yet.
@@ -121,12 +121,12 @@ final class TestStoreSynchronization: XCTestCase {
uuidB: 4 // latest clock from B
])
- XCTAssert(midTasksA.count == 2, "Expected 2, but got \(midTasksA.count)")
- XCTAssert(midTasksB.count == 4, "Expected 4, but got \(midTasksB.count)")
- XCTAssert(midKnowledgeA == storeA.context.knowledgeVector)
- XCTAssert(midKnowledgeB == storeB.context.knowledgeVector)
- XCTAssert(midServerKnowledge == server.knowledgeVector)
- XCTAssert(server.revisions.count == 4) // 4 versions with different vectors
+ XCTAssertEqual(midTasksA.count, 2, "Expected 2, but got \(midTasksA.count)")
+ XCTAssertEqual(midTasksB.count, 4, "Expected 4, but got \(midTasksB.count)")
+ XCTAssertEqual(midKnowledgeA, storeA.context.knowledgeVector)
+ XCTAssertEqual(midKnowledgeB, storeB.context.knowledgeVector)
+ XCTAssertEqual(midServerKnowledge, server.knowledgeVector)
+ XCTAssertEqual(server.revisions.count, 4) // 4 versions with different vectors
// 5. Sync storeA: Pull updates from the server (conflict + resolution)
// Sync storeB: Already up to date, no observable change
@@ -146,11 +146,11 @@ final class TestStoreSynchronization: XCTestCase {
uuidB: 7 // +1 post pull, +1 post push
])
- XCTAssert(finalTasksA.count == 4, "Expected 4, but got \(finalTasksA.count)")
- XCTAssert(finalTasksB.count == 4, "Expected 4, but got \(finalTasksB.count)")
- XCTAssert(finalKnowledgeA == storeA.context.knowledgeVector)
- XCTAssert(finalKnowledgeB == storeB.context.knowledgeVector)
- XCTAssert(server.revisions.count == 4)
+ XCTAssertEqual(finalTasksA.count, 4, "Expected 4, but got \(finalTasksA.count)")
+ XCTAssertEqual(finalTasksB.count, 4, "Expected 4, but got \(finalTasksB.count)")
+ XCTAssertEqual(finalKnowledgeA, storeA.context.knowledgeVector)
+ XCTAssertEqual(finalKnowledgeB, storeB.context.knowledgeVector)
+ XCTAssertEqual(server.revisions.count, 4)
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Tasks.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Tasks.swift
index b290edcb8..9f9a226c3 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Tasks.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore+Tasks.swift
@@ -72,7 +72,7 @@ class TestStoreTasks: XCTestCase {
var task = OCKTask(id: "benadryl", title: "Benadryl", carePlanUUID: nil, schedule: schedule)
task = try store.addTaskAndWait(task)
guard let fetchedElement = task.schedule.elements.first else { XCTFail("Bad schedule"); return }
- XCTAssertTrue(fetchedElement.duration == .allDay)
+ XCTAssertEqual(fetchedElement.duration, .allDay)
}
// MARK: Querying
@@ -83,8 +83,8 @@ class TestStoreTasks: XCTestCase {
let task2 = OCKTask(id: "lunges", title: "Forward Lunges", carePlanUUID: nil, schedule: schedule)
try store.addTasksAndWait([task1, task2])
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery(id: task1.id))
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testQueryTaskByCarePlanIdentifier() throws {
@@ -94,7 +94,7 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery()
query.carePlanIDs = [carePlan.id]
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched == [task])
+ XCTAssertEqual(fetched, [task])
}
func testQueryTaskByCarePlanVersionID() throws {
@@ -104,7 +104,7 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery()
query.carePlanUUIDs = [carePlan.uuid]
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched == [task])
+ XCTAssertEqual(fetched, [task])
}
func testTaskQueryGroupIdentifier() throws {
@@ -118,8 +118,8 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery(dateInterval: interval)
query.groupIdentifiers = ["group1"]
let tasks = try store.fetchTasksAndWait(query: query)
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testTaskQueryForNilGroupIdentifier() throws {
@@ -133,8 +133,8 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery(dateInterval: interval)
query.groupIdentifiers = [nil]
let tasks = try store.fetchTasksAndWait(query: query)
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task2.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task2.id)
}
func testTaskQueryOrdered() throws {
@@ -150,7 +150,7 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery(dateInterval: interval)
query.sortDescriptors = [.title(ascending: true)]
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.map { $0.title } == [nil, "aa", "bb"])
+ XCTAssertEqual(fetched.map { $0.title }, [nil, "aa", "bb"])
}
func testTaskQueryLimited() throws {
@@ -166,7 +166,7 @@ class TestStoreTasks: XCTestCase {
query.limit = 2
let tasks = try store.fetchTasksAndWait(query: query)
- XCTAssert(tasks.map { $0.id } == ["a", "b"])
+ XCTAssertEqual(tasks.map { $0.id }, ["a", "b"])
}
func testTaskQueryTags() throws {
@@ -185,7 +185,7 @@ class TestStoreTasks: XCTestCase {
query.sortDescriptors = [.title(ascending: true)]
let fetched = try store.fetchTasksAndWait(query: query)
let titles = fetched.map { $0.title }
- XCTAssert(titles == ["b", "c"], "Expected [b, c], but got \(titles)")
+ XCTAssertEqual(titles, ["b", "c"], "Expected [b, c], but got \(titles)")
}
func testTaskQueryWithNilQueryReturnsAllTasks() throws {
@@ -195,7 +195,7 @@ class TestStoreTasks: XCTestCase {
let task3 = OCKTask(id: "c", title: "c", carePlanUUID: nil, schedule: schedule)
try store.addTasksAndWait([task1, task2, task3])
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery())
- XCTAssert(tasks.count == 3)
+ XCTAssertEqual(tasks.count, 3)
}
func testQueryTaskByRemoteID() throws {
@@ -206,7 +206,7 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery(for: Date())
query.remoteIDs = ["abc"]
let fetched = try store.fetchTasksAndWait(query: query).first
- XCTAssert(fetched == task)
+ XCTAssertEqual(fetched, task)
}
func testQueryTaskByCarePlanRemoteID() throws {
@@ -220,7 +220,7 @@ class TestStoreTasks: XCTestCase {
var query = OCKTaskQuery(for: Date())
query.carePlanRemoteIDs = ["abc"]
let fetched = try store.fetchTasksAndWait(query: query).first
- XCTAssert(fetched == task)
+ XCTAssertEqual(fetched, task)
}
// MARK: Versioning
@@ -229,8 +229,8 @@ class TestStoreTasks: XCTestCase {
let schedule = OCKSchedule.mealTimesEachDay(start: Date(), end: nil)
let task = try store.addTaskAndWait(OCKTask(id: "meds", title: "Medication", carePlanUUID: nil, schedule: schedule))
let updatedTask = try store.updateTaskAndWait(OCKTask(id: "meds", title: "New Medication", carePlanUUID: nil, schedule: schedule))
- XCTAssert(updatedTask.title == "New Medication")
- XCTAssert(updatedTask.previousVersionUUIDs.first == task.uuid)
+ XCTAssertEqual(updatedTask.title, "New Medication")
+ XCTAssertEqual(updatedTask.previousVersionUUIDs.first, task.uuid)
}
func testCanFetchEventsWhenCurrentTaskVersionStartsAtSameTimeOrEarlierThanThePreviousVersion() throws {
@@ -243,27 +243,27 @@ class TestStoreTasks: XCTestCase {
var nausea = OCKTask(id: "nausea", title: "V1", carePlanUUID: nil, schedule: scheduleV1)
let v1 = try store.addTaskAndWait(nausea)
- XCTAssert(v1.effectiveDate == scheduleV1.startDate())
+ XCTAssertEqual(v1.effectiveDate, scheduleV1.startDate())
nausea.title = "V2"
nausea.schedule = scheduleV2
nausea.effectiveDate = scheduleV2.startDate()
let v2 = try store.updateTaskAndWait(nausea)
- XCTAssert(v2.effectiveDate == scheduleV2.startDate())
+ XCTAssertEqual(v2.effectiveDate, scheduleV2.startDate())
nausea.title = "V3"
nausea.schedule = scheduleV3
nausea.effectiveDate = scheduleV3.startDate()
let v3 = try store.updateTaskAndWait(nausea)
- XCTAssert(v3.effectiveDate == scheduleV3.startDate())
+ XCTAssertEqual(v3.effectiveDate, scheduleV3.startDate())
var query = OCKEventQuery(dateInterval: DateInterval(start: manyDaysAgo, end: thisMorning))
query.taskIDs = ["nausea"]
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 10, "Expected 10, but got \(events.count)")
- XCTAssert(events.first?.task.title == "V1")
- XCTAssert(events.last?.task.title == "V3")
+ XCTAssertEqual(events.count, 10, "Expected 10, but got \(events.count)")
+ XCTAssertEqual(events.first?.task.title, "V1")
+ XCTAssertEqual(events.last?.task.title, "V3")
}
func testCannotUpdateTaskIfItResultsInImplicitDataLoss() throws {
@@ -297,10 +297,10 @@ class TestStoreTasks: XCTestCase {
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 3)
- XCTAssert(events[0].task.uuid == original.uuid)
- XCTAssert(events[1].task.uuid == original.uuid)
- XCTAssert(events[2].task.uuid == updated.uuid)
+ XCTAssertEqual(events.count, 3)
+ XCTAssertEqual(events[0].task.uuid, original.uuid)
+ XCTAssertEqual(events[1].task.uuid, original.uuid)
+ XCTAssertEqual(events[2].task.uuid, updated.uuid)
}
func testUpdateFailsForUnsavedTasks() {
@@ -321,8 +321,8 @@ class TestStoreTasks: XCTestCase {
try store.addTasksAndWait([task1, task2])
let tasks = try store.fetchTasksAndWait(query: OCKTaskQuery(for: Date()))
- XCTAssert(tasks.count == 1)
- XCTAssert(tasks.first?.id == task1.id)
+ XCTAssertEqual(tasks.count, 1)
+ XCTAssertEqual(tasks.first?.id, task1.id)
}
func testTaskQueryOnPastDateReturnsPastVersionOfATask() throws {
@@ -341,8 +341,8 @@ class TestStoreTasks: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(-10))
let query = OCKTaskQuery(dateInterval: interval)
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.count == 1, "Expected to get 1 task, but got \(fetched.count)")
- XCTAssert(fetched.first?.title == taskA.title)
+ XCTAssertEqual(fetched.count, 1, "Expected to get 1 task, but got \(fetched.count)")
+ XCTAssertEqual(fetched.first?.title, taskA.title)
}
func testFetchTaskByIdConvenienceMethodReturnsNewestVersionOfTask() throws {
@@ -362,7 +362,7 @@ class TestStoreTasks: XCTestCase {
let expect = expectation(description: "Fetches V2")
store.fetchAnyTask(withID: "task") { result in
let task = try? result.get()
- XCTAssert(task?.title == "V2")
+ XCTAssertEqual(task?.title, "V2")
expect.fulfill()
}
waitForExpectations(timeout: 0.1, handler: nil)
@@ -377,7 +377,7 @@ class TestStoreTasks: XCTestCase {
task = try store.updateTaskAndWait(task)
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.first == task)
+ XCTAssertEqual(fetched.first, task)
}
func testTaskQuerySpanningVersionsReturnsNewestVersionOnly() throws {
@@ -396,8 +396,8 @@ class TestStoreTasks: XCTestCase {
let interval = DateInterval(start: dateA.addingTimeInterval(10), end: dateB.addingTimeInterval(10))
let query = OCKTaskQuery(dateInterval: interval)
let fetched = try store.fetchTasksAndWait(query: query)
- XCTAssert(fetched.count == 1, "Expected to get 1 task, but got \(fetched.count)")
- XCTAssert(fetched.first?.title == taskB.title, "Expected title to be \(taskB.title ?? "nil"), but got \(fetched.first?.title ?? "nil")")
+ XCTAssertEqual(fetched.count, 1, "Expected to get 1 task, but got \(fetched.count)")
+ XCTAssertEqual(fetched.first?.title, taskB.title, "Expected title to be \(taskB.title ?? "nil"), but got \(fetched.first?.title ?? "nil")")
}
// MARK: Deletion
diff --git a/CareKitStore/CareKitStoreTests/OCKStore/TestStore.swift b/CareKitStore/CareKitStoreTests/OCKStore/TestStore.swift
index 596809ca3..7a9df4b21 100644
--- a/CareKitStore/CareKitStoreTests/OCKStore/TestStore.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStore/TestStore.swift
@@ -63,18 +63,18 @@ class TestStore: XCTestCase {
let store = OCKStore(name: UUID().uuidString, type: .inMemory)
expect(with: store.context) {
- XCTAssert(store.context.clockTime == 1)
+ XCTAssertEqual(store.context.clockTime, 1)
store.context.knowledgeVector.increment(clockFor: store.context.clockID)
try store.context.save()
- XCTAssert(store.context.clockTime == 2)
+ XCTAssertEqual(store.context.clockTime, 2)
store.context.knowledgeVector.increment(clockFor: store.context.clockID)
- XCTAssert(store.context.clockTime == 3)
+ XCTAssertEqual(store.context.clockTime, 3)
store.context.knowledgeVector.increment(clockFor: store.context.clockID)
store.context.rollback()
- XCTAssert(store.context.clockTime == 2)
+ XCTAssertEqual(store.context.clockTime, 2)
}
}
}
diff --git a/CareKitStore/CareKitStoreTests/OCKStoreCoordinator/TestPersistentStoreCoordinator.swift b/CareKitStore/CareKitStoreTests/OCKStoreCoordinator/TestPersistentStoreCoordinator.swift
index cbe01694e..e283d6e63 100644
--- a/CareKitStore/CareKitStoreTests/OCKStoreCoordinator/TestPersistentStoreCoordinator.swift
+++ b/CareKitStore/CareKitStoreTests/OCKStoreCoordinator/TestPersistentStoreCoordinator.swift
@@ -109,7 +109,7 @@ class TestPersistentStoreCoordinator: XCTestCase {
sut.attach(patientStore: store2)
let patients = try sut.fetchAnyPatientsAndWait(query: OCKPatientQuery())
- XCTAssert(patients.count == 2)
+ XCTAssertEqual(patients.count, 2)
}
func testAddPatientActsOnFirstRespondingStore() throws {
@@ -182,9 +182,9 @@ class TestPersistentStoreCoordinator: XCTestCase {
coordinator.attachReadOnly(eventStore: hkStore)
coordinator.fetchAnyTasks(query: OCKTaskQuery()) { result in
let tasks = try? result.get()
- XCTAssert(tasks?.count == 2)
- XCTAssert(tasks?.compactMap { $0 as? OCKTask }.count == 1)
- XCTAssert(tasks?.compactMap { $0 as? OCKHealthKitTask }.count == 1)
+ XCTAssertEqual(tasks?.count, 2)
+ XCTAssertEqual(tasks?.compactMap { $0 as? OCKTask }.count, 1)
+ XCTAssertEqual(tasks?.compactMap { $0 as? OCKHealthKitTask }.count, 1)
}
}
@@ -238,7 +238,7 @@ class TestPersistentStoreCoordinator: XCTestCase {
let query = OCKTaskQuery(id: "task")
let fetched = try coordinator.fetchAnyTasksAndWait(query: query)
- XCTAssert(fetched.first?.belongs(to: plan) == true)
+ XCTAssertEqual(fetched.first?.belongs(to: plan), true)
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestHealthKitLinkage.swift b/CareKitStore/CareKitStoreTests/Structs/TestHealthKitLinkage.swift
index 380766497..6282d638c 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestHealthKitLinkage.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestHealthKitLinkage.swift
@@ -43,6 +43,6 @@ class TestHealthKitLinkage: XCTestCase {
quantityType: .discrete,
unit: unit)
- XCTAssert(linkage.unit == unit)
+ XCTAssertEqual(linkage.unit, unit)
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestKnowledgeVector.swift b/CareKitStore/CareKitStoreTests/Structs/TestKnowledgeVector.swift
index f09205d6f..97365bc0f 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestKnowledgeVector.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestKnowledgeVector.swift
@@ -37,10 +37,12 @@ class TestKnowledgeVector: XCTestCase {
func testEncoding() throws {
let id = UUID()
let vector = OCKRevisionRecord.KnowledgeVector([id: 0])
- let json = try JSONEncoder().encode(vector)
+ let encoder = JSONEncoder()
+ encoder.outputFormatting = .sortedKeys
+ let json = try encoder.encode(vector)
let string = String(data: json, encoding: .utf8)!
- let expected = "{\"processes\":[{\"id\":\"\(id)\",\"clock\":0}]}"
- XCTAssert(string == expected)
+ let expected = "{\"processes\":[{\"clock\":0,\"id\":\"\(id)\"}]}"
+ XCTAssertEqual(string, expected)
}
func testDecoding() throws {
@@ -48,14 +50,14 @@ class TestKnowledgeVector: XCTestCase {
let json = "{\"processes\":[{\"id\":\"\(id)\",\"clock\":0}]}"
let data = json.data(using: .utf8)!
let vector = try JSONDecoder().decode(OCKRevisionRecord.KnowledgeVector.self, from: data)
- XCTAssert(vector == .init([id: 0]))
+ XCTAssertEqual(vector, .init([id: 0]))
}
func testInitialLogicalTimeForOwnProcess() throws {
let vect = OCKRevisionRecord.KnowledgeVector()
let uuid = UUID()
let time = vect.clock(for: uuid)
- XCTAssert(time == 0)
+ XCTAssertEqual(time, 0)
}
func testIncrementProcess() throws {
@@ -64,7 +66,7 @@ class TestKnowledgeVector: XCTestCase {
vect.increment(clockFor: uuid)
vect.increment(clockFor: uuid)
let time = vect.clock(for: uuid)
- XCTAssert(time == 2)
+ XCTAssertEqual(time, 2)
}
func testMergeWithOtherVector() throws {
@@ -92,7 +94,7 @@ class TestKnowledgeVector: XCTestCase {
uuid3: 1
])
- XCTAssert(vectorA == expected)
+ XCTAssertEqual(vectorA, expected)
}
func testEqualVectorsAreNotLessThan() {
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestOutcome.swift b/CareKitStore/CareKitStoreTests/Structs/TestOutcome.swift
index 387a49192..99d55ed10 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestOutcome.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestOutcome.swift
@@ -36,7 +36,7 @@ class TestOutcome: XCTestCase {
func testBelongsToReturnsFalseIfTaskIDsDontMatch() {
let outcome = OCKOutcome(taskUUID: UUID(), taskOccurrenceIndex: 0, values: [])
let task = OCKTask(id: "medicine", title: nil, carePlanUUID: nil, schedule: .mealTimesEachDay(start: Date(), end: nil))
- XCTAssert(outcome.belongs(to: task) == false)
+ XCTAssertFalse(outcome.belongs(to: task))
}
func testBelongsToReturnsTrueIfTasksIDsDoMatch() {
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestOutcomeValue.swift b/CareKitStore/CareKitStoreTests/Structs/TestOutcomeValue.swift
index 65f01d28f..2959f33df 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestOutcomeValue.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestOutcomeValue.swift
@@ -35,13 +35,13 @@ class TestOutcomeValue: XCTestCase {
func testValueInitializer() {
var value = OCKOutcomeValue(37, units: "˚C")
- XCTAssert(value.type == .integer)
- XCTAssert(value.integerValue == 37)
+ XCTAssertEqual(value.type, .integer)
+ XCTAssertEqual(value.integerValue, 37)
value.value = 98.3
value.units = "˚F"
- XCTAssert(value.type == .double)
- XCTAssert(value.doubleValue == 98.3)
+ XCTAssertEqual(value.type, .double)
+ XCTAssertEqual(value.doubleValue, 98.3)
}
func testValueEqualityUnique() {
@@ -57,7 +57,7 @@ class TestOutcomeValue: XCTestCase {
for (before, after) in beforeAfterValuePairs {
let value1 = OCKOutcomeValue(before)
let value2 = OCKOutcomeValue(after)
- XCTAssert(value1 != value2)
+ XCTAssertNotEqual(value1, value2)
}
}
@@ -75,7 +75,7 @@ class TestOutcomeValue: XCTestCase {
for (left, right) in beforeAfterValuePairs {
let value1 = OCKOutcomeValue(left)
let value2 = OCKOutcomeValue(right)
- XCTAssert(value1 == value2)
+ XCTAssertEqual(value1, value2)
}
}
@@ -162,18 +162,18 @@ class TestOutcomeValue: XCTestCase {
var value = OCKOutcomeValue("abc")
let oldType = value.type
value.value = false
- XCTAssert(oldType != value.type)
- XCTAssert(oldType == .text)
- XCTAssert(value.type == .boolean)
+ XCTAssertNotEqual(oldType, value.type)
+ XCTAssertEqual(oldType, .text)
+ XCTAssertEqual(value.type, .boolean)
value.value = Date()
- XCTAssert(value.type == .date)
+ XCTAssertEqual(value.type, .date)
value.value = 10.0
- XCTAssert(value.type == .double)
+ XCTAssertEqual(value.type, .double)
value.value = Int(10)
- XCTAssert(value.type == .integer)
+ XCTAssertEqual(value.type, .integer)
}
func testEqualityOfEncodings(outcome1: OCKOutcomeValue, outcome2: OCKOutcomeValue) {
@@ -181,7 +181,7 @@ class TestOutcomeValue: XCTestCase {
do {
let encoded1 = try encoder.encode(outcome1)
let encoded2 = try encoder.encode(outcome2)
- XCTAssert(encoded1 == encoded2, "OCKOutcomeValue encoding inequality")
+ XCTAssertEqual(encoded1, encoded2, "OCKOutcomeValue encoding inequality")
} catch {
XCTFail("unable to encoder or decode OCKOutcomeValue")
}
@@ -193,7 +193,7 @@ class TestOutcomeValue: XCTestCase {
do {
let encoded = try encoder.encode(outcome)
let decoded = try decoder.decode(OCKOutcomeValue.self, from: encoded)
- XCTAssert(decoded == outcome, "OCKOutcomeValue not preserved in coding")
+ XCTAssertEqual(decoded, outcome, "OCKOutcomeValue not preserved in coding")
testEqualityOfEncodings(outcome1: outcome, outcome2: decoded)
} catch {
XCTFail("unable to encode or decode OCKOutcomeValue")
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestPatient.swift b/CareKitStore/CareKitStoreTests/Structs/TestPatient.swift
index b07bfd00a..bd822e586 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestPatient.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestPatient.swift
@@ -39,6 +39,6 @@ class TestPatient: XCTestCase {
XCTAssertNil(patient.age)
patient.birthday = Calendar.current.date(byAdding: .year, value: -50, to: Date())
- XCTAssert(patient.age == 50)
+ XCTAssertEqual(patient.age, 50)
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestSchedule.swift b/CareKitStore/CareKitStoreTests/Structs/TestSchedule.swift
index 10037b0a9..025ddf145 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestSchedule.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestSchedule.swift
@@ -46,13 +46,13 @@ class TestSchedule: XCTestCase {
let spacing = DateComponents(day: 1)
let element = OCKScheduleElement(start: Date(), end: nil, interval: spacing, text: nil, targetValues: [])
let schedule = OCKSchedule(composing: [element])
- XCTAssert(schedule.elements == [element], "The schedule elements was not equal to the elements that created it")
+ XCTAssertEqual(schedule.elements, [element], "The schedule elements was not equal to the elements that created it")
}
func testDailySchedule() {
let schedule = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: Date(), end: nil, text: nil)
for index in 0..<5 {
- XCTAssert(schedule[index].start == Calendar.current.date(byAdding: DateComponents(day: index), to: schedule.startDate()))
+ XCTAssertEqual(schedule[index].start, Calendar.current.date(byAdding: DateComponents(day: index), to: schedule.startDate()))
}
}
@@ -61,10 +61,10 @@ class TestSchedule: XCTestCase {
let threeDaysFromNow = Calendar.current.date(byAdding: .day, value: 3, to: thisMorning)!
let schedule = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: thisMorning, end: nil, text: nil)
let events = schedule.events(from: thisMorning, to: threeDaysFromNow)
- XCTAssert(events.count == 3)
- XCTAssert(events[0].occurrence == 0)
- XCTAssert(events[1].occurrence == 1)
- XCTAssert(events[2].occurrence == 2)
+ XCTAssertEqual(events.count, 3)
+ XCTAssertEqual(events[0].occurrence, 0)
+ XCTAssertEqual(events[1].occurrence, 1)
+ XCTAssertEqual(events[2].occurrence, 2)
}
func testAllDayEventsCapturedByEventsBetweenDates() {
@@ -75,13 +75,13 @@ class TestSchedule: XCTestCase {
let allDay = OCKScheduleElement(start: breakfast, end: nil, interval: DateComponents(day: 1), text: "Daily", duration: .allDay)
let schedule = OCKSchedule(composing: [allDay])
let events = schedule.events(from: lunch, to: dinner)
- XCTAssert(events.count == 1, "Expected 1 all day event, but got \(events.count)")
+ XCTAssertEqual(events.count, 1, "Expected 1 all day event, but got \(events.count)")
}
func testWeeklySchedule() {
let schedule = OCKSchedule.weeklyAtTime(weekday: 1, hours: 0, minutes: 0, start: Date(), end: nil, targetValues: [], text: nil)
for index in 0..<5 {
- XCTAssert(schedule[index].start == Calendar.current.date(byAdding: DateComponents(weekOfYear: index), to: schedule.startDate()))
+ XCTAssertEqual(schedule[index].start, Calendar.current.date(byAdding: DateComponents(weekOfYear: index), to: schedule.startDate()))
}
}
@@ -95,8 +95,8 @@ class TestSchedule: XCTestCase {
let hours = Calendar.current.component(.hour, from: weekly.startDate())
let minutes = Calendar.current.component(.minute, from: weekly.startDate())
- XCTAssert(hours == 5, "Expected 5, but got \(hours)")
- XCTAssert(minutes == 30, "Expected 30, but got \(minutes)")
+ XCTAssertEqual(hours, 5, "Expected 5, but got \(hours)")
+ XCTAssertEqual(minutes, 30, "Expected 30, but got \(minutes)")
}
func testScheduleComposition() {
@@ -105,7 +105,7 @@ class TestSchedule: XCTestCase {
let scheduleA = OCKSchedule.mealTimesEachDay(start: startDate, end: nil)
let scheduleB = OCKSchedule.mealTimesEachDay(start: startDate, end: nil)
let schedule = OCKSchedule(composing: [scheduleA, scheduleB])
- XCTAssert(schedule.elements.count == 6)
+ XCTAssertEqual(schedule.elements.count, 6)
}
func testStartDate() {
@@ -114,7 +114,7 @@ class TestSchedule: XCTestCase {
let scheduleA = OCKSchedule.dailyAtTime(hour: 10, minutes: 0, start: earlyDate, end: nil, text: nil)
let scheduleB = OCKSchedule.dailyAtTime(hour: 11, minutes: 0, start: lateDate, end: nil, text: nil)
let schedule = OCKSchedule(composing: [scheduleA, scheduleB])
- XCTAssert(schedule.startDate() == scheduleA.startDate())
+ XCTAssertEqual(schedule.startDate(), scheduleA.startDate())
}
func testEndDateIsNilIfAnyComponentHasANilStartDate() {
@@ -123,7 +123,7 @@ class TestSchedule: XCTestCase {
let scheduleA = OCKSchedule.dailyAtTime(hour: 10, minutes: 0, start: earlyDate, end: lateDate, text: nil)
let scheduleB = OCKSchedule.dailyAtTime(hour: 11, minutes: 0, start: lateDate, end: nil, text: nil)
let schedule = OCKSchedule(composing: [scheduleA, scheduleB])
- XCTAssert(schedule.endDate() == nil)
+ XCTAssertNil(schedule.endDate())
}
func testEndDateIsNonNilAndMatchesLatestEndDateIfAllComponentsHaveFiniteEndDate() {
@@ -133,7 +133,7 @@ class TestSchedule: XCTestCase {
let scheduleA = OCKSchedule.dailyAtTime(hour: 10, minutes: 0, start: earlyDate, end: lateDate, text: nil)
let scheduleB = OCKSchedule.dailyAtTime(hour: 11, minutes: 0, start: earlyDate, end: laterDate, text: nil)
let schedule = OCKSchedule(composing: [scheduleA, scheduleB])
- XCTAssert(schedule.endDate() == scheduleB.endDate())
+ XCTAssertEqual(schedule.endDate(), scheduleB.endDate())
XCTAssertNotNil(schedule.endDate())
}
@@ -142,7 +142,7 @@ class TestSchedule: XCTestCase {
let originalSchedule = OCKSchedule.dailyAtTime(hour: 0, minutes: 0, start: date, end: nil, text: nil)
let offsetSchedule = originalSchedule.offset(by: DateComponents(hour: 1))
let expectedSchedule = OCKSchedule.dailyAtTime(hour: 1, minutes: 0, start: date, end: nil, text: nil)
- XCTAssert(offsetSchedule == expectedSchedule)
+ XCTAssertEqual(offsetSchedule, expectedSchedule)
}
func testScheduleEventsAreSortedByStartDate() {
@@ -161,7 +161,7 @@ class TestSchedule: XCTestCase {
func testSubscriptZeroIsEqualToStartDate() {
let schedule = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: Date(), end: nil, text: nil)
- XCTAssert(schedule[0].start == schedule.startDate())
+ XCTAssertEqual(schedule[0].start, schedule.startDate())
}
func testScheduleSubscriptInterleavesComposedSchedulesEventsInChronologicalOrder() {
@@ -173,9 +173,9 @@ class TestSchedule: XCTestCase {
let schedule = OCKSchedule(composing: [scheduleA, scheduleB, scheduleC])
func compareScheduleEventExcludingOccurrence(left: OCKScheduleEvent, right: OCKScheduleEvent) {
- XCTAssert(left.element == right.element)
- XCTAssert(left.start == right.start)
- XCTAssert(left.end == right.end)
+ XCTAssertEqual(left.element, right.element)
+ XCTAssertEqual(left.start, right.start)
+ XCTAssertEqual(left.end, right.end)
}
compareScheduleEventExcludingOccurrence(left: schedule[0], right: scheduleA[0]) // 07:30 Day 1
@@ -189,7 +189,7 @@ class TestSchedule: XCTestCase {
compareScheduleEventExcludingOccurrence(left: schedule[8], right: scheduleC[1]) // 13:00 Day 2
compareScheduleEventExcludingOccurrence(left: schedule[9], right: scheduleA[5]) // 17:30 Day 2
for index in 0..<10 {
- XCTAssert(schedule[index].occurrence == index)
+ XCTAssertEqual(schedule[index].occurrence, index)
}
}
@@ -199,18 +199,18 @@ class TestSchedule: XCTestCase {
let endDate = Calendar.current.date(byAdding: .day, value: 2, to: startDate)!
let mealSchedule = OCKSchedule.mealTimesEachDay(start: startDate, end: nil)
let events = mealSchedule.events(from: middleDate, to: endDate)
- XCTAssert(events.count == 3)
- XCTAssert(events[0].occurrence == 3)
- XCTAssert(events[1].occurrence == 4)
- XCTAssert(events[2].occurrence == 5)
+ XCTAssertEqual(events.count, 3)
+ XCTAssertEqual(events[0].occurrence, 3)
+ XCTAssertEqual(events[1].occurrence, 4)
+ XCTAssertEqual(events[2].occurrence, 5)
}
func testScheduleIntervalsHaveInclusiveLowerBoundAndExclusiveUpperBound() {
let element = OCKScheduleElement(start: Date(), end: nil, interval: DateComponents(day: 1), text: nil, targetValues: [], duration: .allDay)
let schedule = OCKSchedule(composing: [element])
let events = schedule.events(from: schedule[1].start, to: schedule[1].end)
- XCTAssert(events.count == 1)
- XCTAssert(events.first?.occurrence == 1)
+ XCTAssertEqual(events.count, 1)
+ XCTAssertEqual(events.first?.occurrence, 1)
}
func testAllDayScheduleWithEndDate() throws {
@@ -220,7 +220,7 @@ class TestSchedule: XCTestCase {
let schedule = OCKSchedule(composing: [element])
let nextWeek = Calendar.current.date(byAdding: DateComponents(second: 1, weekOfYear: 1), to: beginningOfYear)!
let events = schedule.events(from: beginningOfYear, to: nextWeek)
- XCTAssert(events.count == 2, "Expected 2, but got \(events.count)")
+ XCTAssertEqual(events.count, 2, "Expected 2, but got \(events.count)")
}
// Measure how long it takes to generate 10 years worth of events for a highly complex schedule with hourly events.
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestScheduleElement.swift b/CareKitStore/CareKitStoreTests/Structs/TestScheduleElement.swift
index 56551af13..e624c6db2 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestScheduleElement.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestScheduleElement.swift
@@ -100,7 +100,7 @@ class TestScheduleElement: XCTestCase {
text: nil, targetValues: [])
let offsetElement = originalElement.offset(by: offset)
let expectedStartDate = Calendar.current.date(byAdding: offset, to: date)!
- XCTAssert(offsetElement.start == expectedStartDate)
+ XCTAssertEqual(offsetElement.start, expectedStartDate)
}
// MARK: - Date of occurrence
@@ -140,13 +140,13 @@ class TestScheduleElement: XCTestCase {
let element = OCKScheduleElement(start: aWeekAgo, end: nil, interval: DateComponents(day: 1),
text: nil, targetValues: [], duration: .allDay)
let events = element.events(from: thisMorning, to: tonight)
- XCTAssert(events.count == 1)
+ XCTAssertEqual(events.count, 1)
}
func testEventOccursExactlyOnStartDate() {
let justAfter = Calendar.current.date(byAdding: .second, value: 1, to: element.start)!
let events = element.events(from: date, to: justAfter)
- XCTAssert(events.first!.start == element.start)
+ XCTAssertEqual(events.first!.start, element.start)
}
func testEventCannotOccurExactlyOnEndDate() {
@@ -175,9 +175,9 @@ class TestScheduleElement: XCTestCase {
let mid = Calendar.current.date(byAdding: .year, value: 2, to: date)!
let end = Calendar.current.date(byAdding: .year, value: 4, to: date)!
let events = element.events(from: mid, to: end)
- XCTAssert(events.count == 2)
- XCTAssert(events[0].occurrence == 2)
- XCTAssert(events[1].occurrence == 3)
+ XCTAssertEqual(events.count, 2)
+ XCTAssertEqual(events[0].occurrence, 2)
+ XCTAssertEqual(events[1].occurrence, 3)
}
func testReturnsEmptyArrayIfAskedForEventsStartingAfterEndDate() {
@@ -193,18 +193,18 @@ class TestScheduleElement: XCTestCase {
let events = element.events(from: element.start, to: stop)
for (index, event) in events.enumerated() {
let expectedDate = Calendar.current.date(byAdding: .year, value: index, to: element.start)!
- XCTAssert(event.start == expectedDate)
- XCTAssert(event.occurrence == index)
+ XCTAssertEqual(event.start, expectedDate)
+ XCTAssertEqual(event.occurrence, index)
}
}
func testEventsBetweenEqualIndicesReturnSingleElementArray() {
- XCTAssert(element.events(betweenOccurrenceIndex: 0, and: 1).count == 1)
+ XCTAssertEqual(element.events(betweenOccurrenceIndex: 0, and: 1).count, 1)
}
func testEventsBetweenUnequalIndicesReturnsTheCorrectNumberOfElements() {
- XCTAssert(element.events(betweenOccurrenceIndex: 0, and: 2).count == 2)
- XCTAssert(element.events(betweenOccurrenceIndex: 2, and: 5).count == 3)
+ XCTAssertEqual(element.events(betweenOccurrenceIndex: 0, and: 2).count, 2)
+ XCTAssertEqual(element.events(betweenOccurrenceIndex: 2, and: 5).count, 3)
}
func testEventsBetweenIndicesStopsWhenHittingScheduleEnd() {
@@ -227,7 +227,7 @@ class TestScheduleElement: XCTestCase {
let afternoon = Calendar.current.startOfDay(for: Date()).addingTimeInterval(60 * 60 * 12) // 12:00
let evening = Calendar.current.startOfDay(for: Date()).addingTimeInterval(60 * 60 * 20) // 20:00
let events = allDayElement.events(from: afternoon, to: evening)
- XCTAssert(events.count == 1, "Expected 1 event, but got: \(events.count)")
+ XCTAssertEqual(events.count, 1, "Expected 1 event, but got: \(events.count)")
}
func testEventsBetweenDatesIncludesEventsThatStartAfterTheEndDateButAreAllDayEvents() {
@@ -239,7 +239,7 @@ class TestScheduleElement: XCTestCase {
interval: DateComponents(weekOfYear: 1), duration: .allDay)
let events = allDayElement.events(from: morning, to: afternoon)
- XCTAssert(events.count == 1, "Expected 1 event, but got: \(events.count)")
+ XCTAssertEqual(events.count, 1, "Expected 1 event, but got: \(events.count)")
}
func testEventsBetweenDatesIncludeEventsWithMultidayDurationsThatStartedOnPreviousDays() {
@@ -248,7 +248,7 @@ class TestScheduleElement: XCTestCase {
let twoDaysLater = Calendar.current.date(byAdding: .day, value: 2, to: morning)!
let fourDaysLater = Calendar.current.date(byAdding: .day, value: 4, to: morning)!
let events = element.events(from: twoDaysLater, to: fourDaysLater)
- XCTAssert(events.count == 1, "Expected 1 event, but got: \(events.count)")
+ XCTAssertEqual(events.count, 1, "Expected 1 event, but got: \(events.count)")
}
func testEventsBetweenDatesCanOverlap() {
@@ -257,7 +257,7 @@ class TestScheduleElement: XCTestCase {
let queryStart = morning.addingTimeInterval(60 * 60 * 1.5)
let queryEnd = queryStart.addingTimeInterval(1)
let events = element.events(from: queryStart, to: queryEnd)
- XCTAssert(events.count == 2)
+ XCTAssertEqual(events.count, 2)
}
func testAllDayEventIsFoundWhenScheduleEndsBeforeEventStart() {
@@ -325,6 +325,6 @@ class TestScheduleElement: XCTestCase {
let element = OCKScheduleElement(start: morning, end: nil, interval: DateComponents(hour: 1), duration: .hours(2))
let data = try JSONEncoder().encode(element)
let decodedElement = try JSONDecoder().decode(OCKScheduleElement.self, from: data)
- XCTAssert(element == decodedElement)
+ XCTAssertEqual(element, decodedElement)
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestScheduleEvent.swift b/CareKitStore/CareKitStoreTests/Structs/TestScheduleEvent.swift
index ab02df23a..f681928ab 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestScheduleEvent.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestScheduleEvent.swift
@@ -48,7 +48,7 @@ class TestScheduleEvent: XCTestCase {
)
let event = element[0]
- XCTAssert(event.start == event.end)
+ XCTAssertEqual(event.start, event.end)
}
func testStartDateEndDateForEventWithDuration() {
@@ -58,7 +58,7 @@ class TestScheduleEvent: XCTestCase {
let element = OCKScheduleElement(start: startDate, end: endDate, interval: interval,
text: nil, targetValues: [], duration: .seconds(100))
let event = element[0]
- XCTAssert(event.end == event.start.addingTimeInterval(100))
+ XCTAssertEqual(event.end, event.start.addingTimeInterval(100))
}
func testStartDateEndDateForEventWithAllDayDuration() {
@@ -68,7 +68,7 @@ class TestScheduleEvent: XCTestCase {
let element = OCKScheduleElement(start: startDate, end: endDate, interval: interval,
text: nil, targetValues: [], duration: .allDay)
let event = element[0]
- XCTAssert(event.start == Calendar.current.startOfDay(for: startDate))
- XCTAssert(event.end == Calendar.current.date(byAdding: DateComponents(day: 1, second: -1), to: event.start)!)
+ XCTAssertEqual(event.start, Calendar.current.startOfDay(for: startDate))
+ XCTAssertEqual(event.end, Calendar.current.date(byAdding: DateComponents(day: 1, second: -1), to: event.start)!)
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestSemanticVersion.swift b/CareKitStore/CareKitStoreTests/Structs/TestSemanticVersion.swift
index 67a01d715..4f62028bb 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestSemanticVersion.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestSemanticVersion.swift
@@ -35,39 +35,39 @@ import XCTest
class TestSemanticVersion: XCTestCase {
func testCorrectlyParsesMajorVersion() throws {
let version = try OCKSemanticVersion.parse("3.0.1")
- XCTAssert(version.majorVersion == 3)
+ XCTAssertEqual(version.majorVersion, 3)
}
func testCorrectlyParsesMinorVersion() throws {
let version = try OCKSemanticVersion.parse("3.0.1")
- XCTAssert(version.minorVersion == 0)
+ XCTAssertEqual(version.minorVersion, 0)
}
func testCorrectlyParsesPatchVersion() throws {
let version = try OCKSemanticVersion.parse("3.0.1")
- XCTAssert(version.patchNumber == 1)
+ XCTAssertEqual(version.patchNumber, 1)
}
func testCorrectlyParsesImpliedMinorVersion() throws {
let version = try OCKSemanticVersion.parse("4")
- XCTAssert(version.majorVersion == 4)
- XCTAssert(version.minorVersion == 0)
- XCTAssert(version.patchNumber == 0)
+ XCTAssertEqual(version.majorVersion, 4)
+ XCTAssertEqual(version.minorVersion, 0)
+ XCTAssertEqual(version.patchNumber, 0)
}
func testCorrectlyParsesImpliedPatchNumber() throws {
let version = try OCKSemanticVersion.parse("4.3")
- XCTAssert(version.majorVersion == 4)
- XCTAssert(version.minorVersion == 3)
- XCTAssert(version.patchNumber == 0)
+ XCTAssertEqual(version.majorVersion, 4)
+ XCTAssertEqual(version.minorVersion, 3)
+ XCTAssertEqual(version.patchNumber, 0)
}
func testEquatability() {
let versionA = OCKSemanticVersion(majorVersion: 1, minorVersion: 0, patchNumber: 0)
let versionB = OCKSemanticVersion(majorVersion: 1, minorVersion: 0, patchNumber: 0)
let versionC = OCKSemanticVersion(majorVersion: 1, minorVersion: 0, patchNumber: 1)
- XCTAssert(versionA == versionB)
- XCTAssert(versionA != versionC)
+ XCTAssertEqual(versionA, versionB)
+ XCTAssertNotEqual(versionA, versionC)
}
func testComparability() {
@@ -95,36 +95,36 @@ class TestSemanticVersion: XCTestCase {
func testParseThrowsWhenStringIsEmpty() {
XCTAssertThrowsError(try OCKSemanticVersion.parse(""), "Failed to throw when string is empty") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .emptyString)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .emptyString)
}
}
func testParseThrowsWhenMissingSeparator() {
XCTAssertThrowsError(try OCKSemanticVersion.parse("puppy"), "Failed to throw when missing separator") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .invalidMajorVersion)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .invalidMajorVersion)
}
}
func testParseThrowsWhenMajorVersionIsNotAnInt() {
XCTAssertThrowsError(try OCKSemanticVersion.parse("S.0.1"), "Failed to throw when major version is invalid") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .invalidMajorVersion)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .invalidMajorVersion)
}
}
func testParseThrowsWhenMinorVersionIsNotAnInt() {
XCTAssertThrowsError(try OCKSemanticVersion.parse("1.S.1"), "Failed to throw when minor version is invalid") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .invalidMinorVersion)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .invalidMinorVersion)
}
}
func testParseThrowsWhenPatchVersionIsNotAnInt() {
XCTAssertThrowsError(try OCKSemanticVersion.parse("1.1.S"), "Failed to throw when patch version is invalid") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .invalidPatchVersion)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .invalidPatchVersion)
}
}
func testParseThrowsWhenThereAreToManyValues() {
XCTAssertThrowsError(try OCKSemanticVersion.parse("1.1.1.1"), "Failed to throw when there are too many separators") { error in
- XCTAssert(error as? OCKSemanticVersion.ParsingError == .tooManySeparators)
+ XCTAssertEqual(error as? OCKSemanticVersion.ParsingError, .tooManySeparators)
}
}
}
diff --git a/CareKitStore/CareKitStoreTests/Structs/TestTask.swift b/CareKitStore/CareKitStoreTests/Structs/TestTask.swift
index 3edddc585..41741ff79 100644
--- a/CareKitStore/CareKitStoreTests/Structs/TestTask.swift
+++ b/CareKitStore/CareKitStoreTests/Structs/TestTask.swift
@@ -57,7 +57,7 @@ class TestTask: XCTestCase {
let queryEnd = Calendar.current.date(byAdding: .hour, value: 4, to: schedule.startDate())! // 13:00
let interval = DateInterval(start: queryStart, end: queryEnd)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringIncludesAllDayEventsThatStartBeforeTheQuery() {
@@ -70,7 +70,7 @@ class TestTask: XCTestCase {
let queryEnd = Calendar.current.date(byAdding: .hour, value: 13, to: thisMorning)! // 13:00
let interval = DateInterval(start: queryStart, end: queryEnd)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringIncludesAllDayEventsThatStartAfterTheQuery() {
@@ -84,7 +84,7 @@ class TestTask: XCTestCase {
let queryEnd = Calendar.current.date(byAdding: .hour, value: 13, to: thisMorning)! // 13:00
let interval = DateInterval(start: queryStart, end: queryEnd)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringIncludesTasksForWhichNoEventOccursDuringTheQueryRange() {
@@ -96,7 +96,7 @@ class TestTask: XCTestCase {
let queryEnd = Calendar.current.date(byAdding: .hour, value: 13, to: thisMorning)! // 13:00
let interval = DateInterval(start: queryStart, end: queryEnd)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringIncludesEventsThatStartedOnThePreviousDay() {
@@ -109,7 +109,7 @@ class TestTask: XCTestCase {
let queryEnd = Calendar.current.date(byAdding: .hour, value: 2, to: thisMorning)!
let interval = DateInterval(start: queryStart, end: queryEnd)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringRespectsEffectiveDate() throws {
@@ -122,7 +122,7 @@ class TestTask: XCTestCase {
let interval = DateInterval(start: thisMorning, end: tomorrow)
let filtered = [task].filtered(dateInterval: interval, excludeTasksWithNoEvents: false)
- XCTAssert(filtered == [task])
+ XCTAssertEqual(filtered, [task])
}
func testFilteringExcludesTasksNotDefinedInTheQueryInterval() {
@@ -152,7 +152,7 @@ class TestTask: XCTestCase {
let filtered = [task].filtered(
dateInterval: query.dateInterval,
excludeTasksWithNoEvents: query.excludesTasksWithNoEvents)
- XCTAssert(filtered == [task], "Failed on offset: \(dayOffset)")
+ XCTAssertEqual(filtered, [task], "Failed on offset: \(dayOffset)")
}
for dayOffset in 4...7 {
@@ -162,7 +162,7 @@ class TestTask: XCTestCase {
let filtered = [task].filtered(
dateInterval: query.dateInterval,
excludeTasksWithNoEvents: query.excludesTasksWithNoEvents)
- XCTAssert(filtered == [], "Failed on offset: \(dayOffset)")
+ XCTAssertEqual(filtered, [], "Failed on offset: \(dayOffset)")
}
}
diff --git a/CareKitStore/CareKitStoreTests/TestPartialEvents.swift b/CareKitStore/CareKitStoreTests/TestPartialEvents.swift
index 08e5af360..d1c612813 100644
--- a/CareKitStore/CareKitStoreTests/TestPartialEvents.swift
+++ b/CareKitStore/CareKitStoreTests/TestPartialEvents.swift
@@ -151,15 +151,17 @@ class TestPartialEvents: XCTestCase {
let storedTaskA = try store.addTaskAndWait(taskA)
let storedTaskB = try store.addTaskAndWait(taskB)
+ let expectedEventsArray = [
+ PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[0]),
+ PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[1]),
+ PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[2]),
+ PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[0]),
+ PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[1]),
+ PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[2])
+ ]
+
let expectedEvents = [
- [
- PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[0]),
- PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[1]),
- PartialEvent(task: storedTaskB, scheduleEvent: mealtimesSchedule[2]),
- PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[0]),
- PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[1]),
- PartialEvent(task: storedTaskA, scheduleEvent: mealtimesSchedule[2])
- ]
+ expectedEventsArray
]
let query = OCKTaskQuery()
@@ -175,7 +177,17 @@ class TestPartialEvents: XCTestCase {
// Ensure the results are equal
XCTAssertEqual(expectedEvents, fetchedEvents)
- XCTAssertEqual(fetchedEvents, streamedEvents)
+
+ guard let streamedEventsArray = streamedEvents.first else {
+ XCTFail("Should have atleast one item")
+ return
+ }
+
+ XCTAssertEqual(expectedEventsArray.count, streamedEventsArray.count)
+ // Streamed tasks are not always in order, check for each one.
+ for streamedEvent in streamedEventsArray {
+ XCTAssertTrue(expectedEventsArray.contains(streamedEvent))
+ }
}
// MARK: - Utilities
diff --git a/CareKitStore/CareKitStoreTests/TestStoreProtocolExtensions.swift b/CareKitStore/CareKitStoreTests/TestStoreProtocolExtensions.swift
index 9591a01f1..c150debad 100644
--- a/CareKitStore/CareKitStoreTests/TestStoreProtocolExtensions.swift
+++ b/CareKitStore/CareKitStoreTests/TestStoreProtocolExtensions.swift
@@ -75,8 +75,8 @@ class TestStoreProtocolExtensions: XCTestCase {
try store.updateTaskAndWait(taskV2)
let events = try store.fetchEventsAndWait(query: query)
guard events.count == 6 else { XCTFail("Expected 6 events, but got \(events.count)"); return }
- for index in 0..<3 { XCTAssert(events[index].task.title == taskV1.title) }
- for index in 3..<6 { XCTAssert(events[index].task.title == taskV2.title) }
+ for index in 0..<3 { XCTAssertEqual(events[index].task.title, taskV1.title) }
+ for index in 3..<6 { XCTAssertEqual(events[index].task.title, taskV2.title) }
}
func testFetchEventsAcrossVersionsWithOverlappingInfiniteSchedules() throws {
@@ -99,8 +99,8 @@ class TestStoreProtocolExtensions: XCTestCase {
try store.updateTaskAndWait(taskV2)
let events = try store.fetchEventsAndWait(query: query)
guard events.count == 4 else { XCTFail("Expected 4 events, but got \(events.count)"); return }
- for index in 0..<1 { XCTAssert(events[index].task.title == taskV1.title) }
- for index in 1..<4 { XCTAssert(events[index].task.title == taskV2.title) }
+ for index in 0..<1 { XCTAssertEqual(events[index].task.title, taskV1.title) }
+ for index in 1..<4 { XCTAssertEqual(events[index].task.title, taskV2.title) }
}
func testFetchEventsReturnsEventsWithTheCorrectOccurrenceIndex() throws {
@@ -119,12 +119,12 @@ class TestStoreProtocolExtensions: XCTestCase {
query.taskIDs = [task.id]
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 4)
- XCTAssert(events[0].scheduleEvent.occurrence == 2)
- XCTAssert(events[1].scheduleEvent.occurrence == 3)
- XCTAssert(events[2].scheduleEvent.occurrence == 4)
- XCTAssert(events[3].scheduleEvent.occurrence == 5)
- XCTAssert(events[1].outcome?.taskOccurrenceIndex == 3)
+ XCTAssertEqual(events.count, 4)
+ XCTAssertEqual(events[0].scheduleEvent.occurrence, 2)
+ XCTAssertEqual(events[1].scheduleEvent.occurrence, 3)
+ XCTAssertEqual(events[2].scheduleEvent.occurrence, 4)
+ XCTAssertEqual(events[3].scheduleEvent.occurrence, 5)
+ XCTAssertEqual(events[1].outcome?.taskOccurrenceIndex, 3)
}
func testFetchEventsEveryOtherDay() throws {
@@ -211,8 +211,8 @@ class TestStoreProtocolExtensions: XCTestCase {
query.taskIDs = ["A"]
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 1, "Expected to get 1 event, but got \(events.count)")
- XCTAssert(events.first?.task.title == versionA.title)
+ XCTAssertEqual(events.count, 1, "Expected to get 1 event, but got \(events.count)")
+ XCTAssertEqual(events.first?.task.title, versionA.title)
}
func testFetchEventsReturnsOnlyTheNewerOfTwoEventsWhenTwoVersionsOfATaskHaveEventsAtQueryStart() throws {
@@ -229,8 +229,8 @@ class TestStoreProtocolExtensions: XCTestCase {
query.taskIDs = ["123"]
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 1, "Expected 1, but got \(events.count)")
- XCTAssert(events.first?.task.title == "B")
+ XCTAssertEqual(events.count, 1, "Expected 1, but got \(events.count)")
+ XCTAssertEqual(events.first?.task.title, "B")
}
func testFetchEventsReturnsAnEventForEachVersionOfATaskWhenEventsAreAllDayDuration() throws {
@@ -249,7 +249,7 @@ class TestStoreProtocolExtensions: XCTestCase {
query.taskIDs = ["A"]
let events = try store.fetchEventsAndWait(query: query)
- XCTAssert(events.count == 11)
+ XCTAssertEqual(events.count, 11)
}
func testFetchingEventsForMultipleTasks() throws {
@@ -261,8 +261,8 @@ class TestStoreProtocolExtensions: XCTestCase {
let query = OCKEventQuery(for: Date())
let events = try store.fetchEventsAndWait(query: query)
let tasks = Set(events.map { $0.task.id })
- XCTAssert(events.count == 2)
- XCTAssert(tasks == Set(["A", "B"]))
+ XCTAssertEqual(events.count, 2)
+ XCTAssertEqual(tasks, Set(["A", "B"]))
}
func testFetchZeroDurationEventWithQueryEndOnEventStart() async throws {
@@ -1066,8 +1066,8 @@ class TestStoreProtocolExtensions: XCTestCase {
)
let adherence = try store.fetchAdherenceAndWait(query: query)
- XCTAssert(adherence == [.noTasks, .noTasks, .progress(0.5), .progress(0.5)])
- XCTAssert(timesCalled == 2)
+ XCTAssertEqual(adherence, [.noTasks, .noTasks, .progress(0.5), .progress(0.5)])
+ XCTAssertEqual(timesCalled, 2)
}
private func fetchTask(withUUID uuid: UUID) async throws -> OCKTask {
diff --git a/CareKitStore/CareKitStoreTests/TestWatchConnectivityPeer.swift b/CareKitStore/CareKitStoreTests/TestWatchConnectivityPeer.swift
index 23f7d399d..866ef45a9 100644
--- a/CareKitStore/CareKitStoreTests/TestWatchConnectivityPeer.swift
+++ b/CareKitStore/CareKitStoreTests/TestWatchConnectivityPeer.swift
@@ -72,10 +72,10 @@ class TestWatchConnectivityPeer: XCTestCase {
let tasksA1 = try storeA.fetchTasksAndWait()
let tasksB1 = try storeA.fetchTasksAndWait()
- XCTAssert(tasksA1.count == 1)
- XCTAssert(tasksB1.count == 1)
- XCTAssert(storeA.context.knowledgeVector == stateA1)
- XCTAssert(storeB.context.knowledgeVector == stateB1)
+ XCTAssertEqual(tasksA1.count, 1)
+ XCTAssertEqual(tasksB1.count, 1)
+ XCTAssertEqual(storeA.context.knowledgeVector, stateA1)
+ XCTAssertEqual(storeB.context.knowledgeVector, stateB1)
// 2. Create conflicting updates on A and B, then sync again.
// A goes first, resolves the conflict, and sends the patch to B.
@@ -96,10 +96,10 @@ class TestWatchConnectivityPeer: XCTestCase {
let tasksA2 = try storeA.fetchTasksAndWait()
let tasksB2 = try storeB.fetchTasksAndWait()
- XCTAssert(tasksA2.count == 4)
- XCTAssert(tasksB2.count == 4)
- XCTAssert(storeA.context.knowledgeVector == stateA2)
- XCTAssert(storeB.context.knowledgeVector == stateB2)
+ XCTAssertEqual(tasksA2.count, 4)
+ XCTAssertEqual(tasksB2.count, 4)
+ XCTAssertEqual(storeA.context.knowledgeVector, stateA2)
+ XCTAssertEqual(storeB.context.knowledgeVector, stateB2)
}
}
diff --git a/CareKitUI/CareKitUI.docc/CareKitUI.md b/CareKitUI/CareKitUI.docc/CareKitUI.md
index aaa30caf1..acd613b36 100644
--- a/CareKitUI/CareKitUI.docc/CareKitUI.md
+++ b/CareKitUI/CareKitUI.docc/CareKitUI.md
@@ -1,21 +1,131 @@
# ``CareKitUI``
-CareKit is an open source framework that you use to build apps to manage and understand health data. Your apps can highlight trends, celebrate goals, and create incentives for users. CareKit makes it easy to provide engaging, consistent interfaces with delightful animations, and full interaction with the accessibility features of iOS and iPadOS.
+Manage and display patient care data on your app.
## Overview
-This open source framework is written entirely in Swift, and leverages some of the most powerful Swift language features.
+CareKitUI provides the views that you use to display patient care data. The views are open and extensible subclasses of . Properties within the views are public and give you full control over the content.
-Your CareKit apps can:
+## Topics
-- Easily digitize a prescription.
+### Single care tasks
-- Provide meaningful health data and trends to users.
+- ``SimpleTaskView``
+- ``OCKSimpleTaskView``
+- ``InstructionsTaskView``
+- ``OCKInstructionsTaskView``
+- ``CircularCompletionView``
+- ``OCKCheckmarkButton``
+- ``RectangularCompletionView``
-- Allow users to connect with their care providers.
+### Multiple care tasks
-The framework provides a powerful set of data models for persistence. Your app’s user is a patient in CareKit. A patient needs to complete a set of tasks, like taking a medication or logging their symptoms. You create tasks with a schedule, so a patient knows when to perform each task. Schedules are composable, so you can build a complex set of requirements by combining simple ones.
+- ``OCKGridTaskView``
+- ``OCKChecklistTaskView``
+- ``OCKChecklistItemButton``
+- ``OCKGridTaskCell``
+- ``OCKLabeledCheckmarkButton``
-The combination of a patient’s tasks make up a care plan. A care plan helps a user improve part of their health. For example, a patient may be recovering from an operation or managing diabetes. They can also have multiple care plans, and each care plan can have contacts associated to them. Contacts are the patient’s care providers.
+### Log-based care tasks
-When a patient completes a task, CareKit stores the results as outcomes. These outcomes and their associated values enable you to provide charts and graphs for a user that help them understand the health impact of their care plan.
+- ``OCKButtonLogTaskView``
+- ``OCKLogTaskView``
+- ``OCKLogButtonCell``
+- ``OCKLogItemButton``
+
+### Read-only care tasks
+
+- ``NumericProgressTaskView``
+- ``LabeledValueTaskView``
+- ``LabeledValueTaskViewStatus``
+
+### Care task details
+
+- ``OCKDetailView``
+
+### Contacts
+
+- ``OCKSimpleContactView``
+- ``OCKDetailedContactView``
+- ``OCKAddressButton``
+- ``OCKContactButton``
+
+### Charts
+
+- ``OCKCartesianChartView``
+- ``OCKCartesianGraphView``
+- ``OCKDataSeries``
+
+### Calendar
+
+- ``OCKWeekCalendarView``
+- ``OCKCompletionRingButton``
+- ``OCKCompletionRingView``
+- ``OCKCompletionState``
+
+### Links
+
+- ``LinkView``
+- ``LinkItem``
+
+### Featured content
+
+- ``OCKFeaturedContentView``
+- ``OCKFeaturedContentViewDelegate``
+
+### Common view components
+
+- ``CardView``
+- ``OCKCardable``
+- ``HeaderView``
+- ``OCKHeaderView``
+- ``OCKStackView``
+- ``OCKSeparatorView``
+- ``OCKLabel``
+- ``OCKLabeledButton``
+- ``OCKAnimatedButton``
+- ``OCKView``
+- ``OCKResponsiveLayout``
+
+### Task-interaction broadcasting
+
+- ``OCKTaskDisplayable``
+- ``OCKTaskViewDelegate``
+
+### Contact-interaction broadcasting
+
+- ``OCKContactDisplayable``
+- ``OCKContactViewDelegate``
+
+### Chart-interaction broadcasting
+
+- ``OCKChartDisplayable``
+- ``OCKChartViewDelegate``
+
+### Calendar-interaction broadcasting
+
+- ``OCKCalendarDisplayable``
+- ``OCKCalendarViewDelegate``
+
+### Styles
+
+- ``OCKStylable``
+- ``OCKStyle``
+- ``OCKAnimationStyle``
+- ``OCKAppearanceStyle``
+- ``OCKColorStyle``
+- ``OCKDimensionStyle``
+- ``OCKStyler``
+- ``OCKAnimationStyler``
+- ``OCKAppearanceStyler``
+- ``OCKColorStyler``
+- ``OCKDimensionStyler``
+
+### Logging
+
+- ``OCKLog``
+
+### Localization
+
+- ``OCKLocalization``
+- ``loc(_:_:arguments:)``
diff --git a/CareKitUI/CareKitUI/iOS/Link/LinkButton.swift b/CareKitUI/CareKitUI/iOS/Link/LinkButton.swift
index 4b1fb49cb..6ac4361c6 100644
--- a/CareKitUI/CareKitUI/iOS/Link/LinkButton.swift
+++ b/CareKitUI/CareKitUI/iOS/Link/LinkButton.swift
@@ -89,7 +89,7 @@ struct LinkButton: View {
}
}
- private func styled(label: Label) -> some View {
+ private func styled(label: Label) -> some View {
RectangularCompletionView(isComplete: true) {
label
.if(usesDefaultPadding) { $0.padding() }
diff --git a/CareKitUI/CareKitUI/iOS/OCKResponsiveLayout.swift b/CareKitUI/CareKitUI/iOS/OCKResponsiveLayout.swift
index ffc79410c..51f76b53a 100644
--- a/CareKitUI/CareKitUI/iOS/OCKResponsiveLayout.swift
+++ b/CareKitUI/CareKitUI/iOS/OCKResponsiveLayout.swift
@@ -40,11 +40,11 @@ public struct OCKResponsiveLayout {
/// A default `SizeClassRuleSet` to apply for different `UIContentSizeCategory`'s when the
/// exact `UserInterfaceSizeClass` is not important.
- public let defaultRuleSet: SizeClassRuleSet
+ public let defaultRuleSet: SizeClassRuleSet
/// A set of `UserInterfaceSizeClass` specific rule sets to provide different accessible layouts
/// for specific size class combinations.
- public let sizeClassSpecificRuleSets: [SizeClassRuleSet]
+ public let sizeClassSpecificRuleSets: [SizeClassRuleSet]
/// A lightweight typealias for a horizontal and vertical `UIUserInterfaceSizeClass` definition.
///
@@ -62,11 +62,11 @@ public struct OCKResponsiveLayout {
public init(
defaultLayout: LayoutOption,
anySizeClassRuleSet: [OCKResponsiveLayout.Rule],
- sizeClassSpecificRuleSets: [SizeClassRuleSet] = []) {
+ sizeClassSpecificRuleSets: [SizeClassRuleSet] = []) {
let defaultRule = Rule(layout: defaultLayout, greaterThanOrEqualToContentSizeCategory: .unspecified)
- self.defaultRuleSet = SizeClassRuleSet(
+ self.defaultRuleSet = SizeClassRuleSet(
sizeClasses: [(horizontal: .unspecified, vertical: .unspecified)],
rules: [defaultRule] + anySizeClassRuleSet
)
@@ -100,7 +100,7 @@ public struct OCKResponsiveLayout {
}
/// A set of `UIContentSizeCategory` specific rules for a given size class.
- public struct SizeClassRuleSet {
+ public struct SizeClassRuleSet {
/// A set of rules (combinations of `UIUserInterFaceSizeClass` combinations and user defined layouts.
public let rules: [OCKResponsiveLayout.Rule]
@@ -145,7 +145,7 @@ public struct OCKResponsiveLayout {
/// extending this method to respond to `contentSize` or `contentInsets` to maintain this convenience.
public func responsiveLayoutRule(traitCollection: UITraitCollection) -> LayoutOption {
- func setContainsCurrentSizeClass(set: SizeClassRuleSet) -> Bool {
+ func setContainsCurrentSizeClass(set: SizeClassRuleSet) -> Bool {
return set.sizeClasses.contains { width, height -> Bool in
return width == traitCollection.horizontalSizeClass && height == traitCollection.verticalSizeClass
}
@@ -157,7 +157,7 @@ public struct OCKResponsiveLayout {
}
}
- func layoutOptionForLayoutRuleSet(set: SizeClassRuleSet) -> LayoutOption {
+ func layoutOptionForLayoutRuleSet(set: SizeClassRuleSet) -> LayoutOption {
let sorted = set.rules.sorted(by: { $0.contentSizeCategory < $1.contentSizeCategory })
guard let layout =
diff --git a/CareKitUI/CareKitUITests/Link/TestLinkType.swift b/CareKitUI/CareKitUITests/Link/TestLinkType.swift
index 7a693a98c..05499838c 100644
--- a/CareKitUI/CareKitUITests/Link/TestLinkType.swift
+++ b/CareKitUI/CareKitUITests/Link/TestLinkType.swift
@@ -84,7 +84,7 @@ class TestLinkType: XCTestCase {
}
func testURLFails() {
- let observed = LinkItem.website(" ", title: "").url
+ let observed = LinkItem.website("", title: "").url
XCTAssertNil(observed)
}
}
diff --git a/CareKitUI/CareKitUITests/OCKResponsiveLayoutTests.swift b/CareKitUI/CareKitUITests/OCKResponsiveLayoutTests.swift
index 6a8f0ee4d..7a11e473f 100644
--- a/CareKitUI/CareKitUITests/OCKResponsiveLayoutTests.swift
+++ b/CareKitUI/CareKitUITests/OCKResponsiveLayoutTests.swift
@@ -104,7 +104,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .rotation(let val): XCTAssert(val == 90)
+ case .rotation(let val): XCTAssertEqual(val, 90)
default: XCTFail("Result was unexpected value")
}
}
@@ -114,7 +114,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .rotation(let val): XCTAssert(val == 90)
+ case .rotation(let val): XCTAssertEqual(val, 90)
default: XCTFail("Result was unexpected value")
}
}
@@ -124,7 +124,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 3)
+ case .spiral(let val): XCTAssertEqual(val, 3)
default: XCTFail("Result was unexpected value")
}
}
@@ -134,7 +134,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 5)
+ case .spiral(let val): XCTAssertEqual(val, 5)
default: XCTFail("Result was unexpected value")
}
}
@@ -144,7 +144,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 5)
+ case .spiral(let val): XCTAssertEqual(val, 5)
default: XCTFail("Result was unexpected value")
}
}
@@ -154,7 +154,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = defaultTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssertFalse(val == 3)
+ case .spiral(let val): XCTAssertNotEqual(val, 3)
default: break
}
}
@@ -172,14 +172,14 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = missingDefaultLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 6)
+ case .spiral(let val): XCTAssertEqual(val, 6)
default: XCTFail("Layout was unexpected value")
}
let failureTraitCollection = UITraitCollection(preferredContentSizeCategory: .extraSmall)
switch missingDefaultLayoutDefinition.responsiveLayoutRule(traitCollection: failureTraitCollection) {
- case .spiral(let val): XCTAssert(val == 5)
+ case .spiral(let val): XCTAssertEqual(val, 5)
default: XCTFail("Layout was unexpected value")
}
}
@@ -194,7 +194,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = sizeClassTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .estimatedWidth(let val): XCTAssert(val == 300)
+ case .estimatedWidth(let val): XCTAssertEqual(val, 300)
default: XCTFail("Layout was unexpected value")
}
}
@@ -239,7 +239,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = extraSmallTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 4)
+ case .spiral(let val): XCTAssertEqual(val, 4)
default: XCTFail("Layout was unexpected value")
}
}
@@ -254,7 +254,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
let result = undefinedTestLayoutDefinition.responsiveLayoutRule(traitCollection: traitCollection)
switch result {
- case .spiral(let val): XCTAssert(val == 3)
+ case .spiral(let val): XCTAssertEqual(val, 3)
default: XCTFail("Layout was unexpected value")
}
}
@@ -287,7 +287,7 @@ class OCKResponsiveLayoutTests: XCTestCase {
)
switch result {
- case .estimatedWidth(let val): XCTAssert(val == 200)
+ case .estimatedWidth(let val): XCTAssertEqual(val, 200)
default: XCTFail("Layout was unexpected value")
}
}
diff --git a/Package.swift b/Package.swift
index b388c446d..f1afb201e 100644
--- a/Package.swift
+++ b/Package.swift
@@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "CareKit",
defaultLocalization: "en",
- platforms: [.iOS(.v14), .macOS(.v11), .watchOS(.v7)],
+ platforms: [.iOS(.v14), .macOS(.v13), .watchOS(.v7)],
products: [
.library(
name: "CareKit",
@@ -20,12 +20,13 @@ let package = Package(
.library(
name: "CareKitFHIR",
- targets: ["CareKitFHIR"])
+ targets: ["CareKitFHIR"]),
+
],
dependencies: [
.package(
url: "https://github.com/apple/FHIRModels.git",
- from: Version(0, 1, 0)
+ exact: Version(0, 4, 0)
),
.package(
url: "https://github.com/apple/swift-async-algorithms",
@@ -90,6 +91,7 @@ let package = Package(
name: "CareKitTests",
dependencies: ["CareKit"],
path: "CareKit/CareKitTests",
- exclude: ["Info.plist"])
+ exclude: ["Info.plist"]),
+
]
)