Skip to content

Commit ecca760

Browse files
committed
feat: enhance ScheduleWithPreparationEntity to include preparation name in string representation and add unit test for cache fingerprint changes on preparation step name modification.
1 parent d201886 commit ecca760

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

lib/domain/entities/schedule_with_preparation_entity.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class ScheduleWithPreparationEntity extends ScheduleEntity {
4141
buffer
4242
..write(step.id)
4343
..write(':')
44+
..write(step.preparationName)
45+
..write(':')
4446
..write(step.preparationTime.inMilliseconds)
4547
..write(':')
4648
..write(step.nextPreparationId ?? '')

test/domain/entities/preparation_timing_entity_test.dart

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,54 @@ void main() {
6565
expect(progressed.currentStepRemainingTime, Duration.zero);
6666
expect(progressed.progress, 1.0);
6767
});
68+
69+
test('cache fingerprint changes when preparation step name changes', () {
70+
final baseline = ScheduleWithPreparationEntity(
71+
id: 'schedule-cache',
72+
place: PlaceEntity(id: 'p1', placeName: 'Office'),
73+
scheduleName: 'Meeting',
74+
scheduleTime: DateTime(2026, 3, 20, 10, 0),
75+
moveTime: const Duration(minutes: 20),
76+
isChanged: false,
77+
isStarted: false,
78+
scheduleSpareTime: const Duration(minutes: 10),
79+
scheduleNote: '',
80+
preparation: const PreparationWithTimeEntity(
81+
preparationStepList: [
82+
PreparationStepWithTimeEntity(
83+
id: 's1',
84+
preparationName: 'Wash',
85+
preparationTime: Duration(minutes: 10),
86+
nextPreparationId: null,
87+
),
88+
],
89+
),
90+
);
91+
final renamed = ScheduleWithPreparationEntity(
92+
id: 'schedule-cache',
93+
place: PlaceEntity(id: 'p1', placeName: 'Office'),
94+
scheduleName: 'Meeting',
95+
scheduleTime: DateTime(2026, 3, 20, 10, 0),
96+
moveTime: const Duration(minutes: 20),
97+
isChanged: false,
98+
isStarted: false,
99+
scheduleSpareTime: const Duration(minutes: 10),
100+
scheduleNote: '',
101+
preparation: const PreparationWithTimeEntity(
102+
preparationStepList: [
103+
PreparationStepWithTimeEntity(
104+
id: 's1',
105+
preparationName: 'Makeup',
106+
preparationTime: Duration(minutes: 10),
107+
nextPreparationId: null,
108+
),
109+
],
110+
),
111+
);
112+
113+
expect(
114+
baseline.cacheFingerprint, isNot(equals(renamed.cacheFingerprint)));
115+
});
68116
});
69117

70118
group('ScheduleState timing helper', () {

0 commit comments

Comments
 (0)