test(sync): rest days of two devices both count; the goal comes along
All checks were successful
CI / check (push) Successful in 6m12s
CI / deploy (push) Successful in 7s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-01 22:16:51 +02:00
commit 50b6bec329
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -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);
}
});
}