File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,26 @@ class BolusEntryViewModelTests: XCTestCase {
348
348
XCTAssertEqual ( . stalePumpData, bolusEntryViewModel. activeNotice)
349
349
}
350
350
351
+ func testUpdateRecommendedBolusThrowsGlucoseTooOld( ) async throws {
352
+ XCTAssertFalse ( bolusEntryViewModel. isBolusRecommended)
353
+ delegate. loopState. bolusRecommendationError = LoopError . glucoseTooOld ( date: now)
354
+ await bolusEntryViewModel. update ( )
355
+ XCTAssertFalse ( bolusEntryViewModel. isBolusRecommended)
356
+ let recommendedBolus = bolusEntryViewModel. recommendedBolus
357
+ XCTAssertNil ( recommendedBolus)
358
+ XCTAssertEqual ( . staleGlucoseData, bolusEntryViewModel. activeNotice)
359
+ }
360
+
361
+ func testUpdateRecommendedBolusThrowsGlucoseInFuture( ) async throws {
362
+ XCTAssertFalse ( bolusEntryViewModel. isBolusRecommended)
363
+ delegate. loopState. bolusRecommendationError = LoopError . glucoseInFuture ( date: now)
364
+ await bolusEntryViewModel. update ( )
365
+ XCTAssertFalse ( bolusEntryViewModel. isBolusRecommended)
366
+ let recommendedBolus = bolusEntryViewModel. recommendedBolus
367
+ XCTAssertNil ( recommendedBolus)
368
+ XCTAssertEqual ( . futureGlucoseData, bolusEntryViewModel. activeNotice)
369
+ }
370
+
351
371
func testUpdateRecommendedBolusThrowsOtherError( ) async throws {
352
372
XCTAssertFalse ( bolusEntryViewModel. isBolusRecommended)
353
373
delegate. loopState. bolusRecommendationError = LoopError . pumpSuspended
You can’t perform that action at this time.
0 commit comments