test(sync): rest days of two devices both count; the goal comes along
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
a52e96b27c
commit
50b6bec329
1 changed files with 28 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import 'dart:io';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/content/rich_content.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/model/card_content.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/home/model/study_goal.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/settings/model/person_settings.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_content.dart';
|
||||
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart';
|
||||
|
|
@ -143,4 +144,31 @@ void main() {
|
|||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('rest days chosen on two devices offline both count, and the goal '
|
||||
'set on one comes to the other', () async {
|
||||
final phone = await device('phone');
|
||||
final laptop = await device('laptop');
|
||||
|
||||
await phone.settings.update(
|
||||
(s) => s.copyWith(
|
||||
restDays: {DateTime(2026, 10, 5)},
|
||||
goal: const StudyGoal(period: GoalPeriod.day, target: 30),
|
||||
),
|
||||
);
|
||||
await laptop.settings.update(
|
||||
(s) => s.copyWith(restDays: {DateTime(2026, 10, 6)}),
|
||||
);
|
||||
await phone.sync();
|
||||
await laptop.sync();
|
||||
await laptop.settings.read();
|
||||
await laptop.sync();
|
||||
await phone.sync();
|
||||
|
||||
for (final device in [phone, laptop]) {
|
||||
final settings = await device.settings.read();
|
||||
expect(settings.restDays, {DateTime(2026, 10, 5), DateTime(2026, 10, 6)});
|
||||
expect(settings.goal?.target, 30);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue