Commit 04bb9c9

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2024-06-21 10:55:28
add utility named getters for FullEntry elements
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 1e8c2cb
Changed files (2)
health_data_store
lib
src
test
health_data_store/lib/src/types/full_entry.dart
@@ -9,6 +9,15 @@ extension FastFullEntryGetters on FullEntry {
   /// Timestamp when the entry occurred.
   DateTime get time => this.$1.time;
 
+  /// Record stored in this entry.
+  BloodPressureRecord get recordObj => this.$1;
+
+  /// Note stored in this entry.
+  Note get noteObj => this.$2;
+
+  /// Medicine intakes stored in this entry.
+  List<MedicineIntake> get intakes => this.$3;
+
   /// Systolic value of the measurement.
   Pressure? get sys => this.$1.sys;
 
health_data_store/test/src/types/full_entry_test.dart
@@ -89,8 +89,9 @@ void main() {
       note: 'Some test',
       color: 0xFFEEDD,
     );
+    final intake = mockIntake(mockMedicine());
 
-    final FullEntry entry = (record, note, []);
+    final FullEntry entry = (record, note, [intake]);
 
     expect(entry.time, record.time);
     expect(entry.sys, record.sys);
@@ -98,5 +99,9 @@ void main() {
     expect(entry.pul, record.pul);
     expect(entry.note, note.note);
     expect(entry.color, note.color);
+    expect(entry.intakes, hasLength(1));
+    expect(entry.intakes, contains(intake));
+    expect(entry.recordObj, record);
+    expect(entry.noteObj, note);
   });
 }