From c189d8ad35395229831011c5bb6517fb7451c432 Mon Sep 17 00:00:00 2001 From: diffwireauto <330573775+diffwireauto@users.noreply.github.com> Date: Sat, 28 Nov 2026 03:10:34 -0500 Subject: [PATCH] test(#1253): check the Remote CLI flag byte, not the timestamped frame The contact-update frame carries last_advert_timestamp, which defaults to now in whole seconds. The tests compared the whole frame the dialog wrote with one they built afterwards, after waiting on real time, so a second ticking over in between failed them with the flags correct. It failed PR #1252 on the same commit that had passed on dev. They now check the flags byte of every update frame written. With a forced 1.1 s wait before the assertions, the old comparison fails every time and the new one passes. Co-Authored-By: Claude Opus 5.5 --- .../contact_settings_remote_cli_test.dart | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/widgets/contact_settings_remote_cli_test.dart b/test/widgets/contact_settings_remote_cli_test.dart index e1998a50..3906a76d 100644 --- a/test/widgets/contact_settings_remote_cli_test.dart +++ b/test/widgets/contact_settings_remote_cli_test.dart @@ -108,11 +108,12 @@ void main() { ); } - bool wrote(Uint8List frame) => sent.any( - (f) => - f.length == frame.length && - Iterable.generate(f.length).every((i) => f[i] == frame[i]), - ); + /// The flags byte of every contact-update frame written. Whole frames can't + /// be compared: they carry last_advert_timestamp, "now" in seconds when the + /// dialog saves, and a second can tick over before the test builds its own + /// expected frame (#1253). Layout: cmd, 32-byte key, type, flags. + Set writtenFlags() => + sent.where(isUpdateFrame).map((f) => f[1 + 32 + 1]).toSet(); tearDown(() async { BlobStore.clearTestOverride(); @@ -204,8 +205,7 @@ void main() { await closeAndSave(tester); - expect(wrote(updateFrame(contact, contactFlagRemoteCliAllowed)), isTrue); - expect(wrote(updateFrame(contact, 0)), isFalse); + expect(writtenFlags(), {contactFlagRemoteCliAllowed}); }); testWidgets('switch shown and turned off: saving clears the grant', ( @@ -222,7 +222,6 @@ void main() { await closeAndSave(tester); - expect(wrote(updateFrame(contact, 0)), isTrue); - expect(wrote(updateFrame(contact, contactFlagRemoteCliAllowed)), isFalse); + expect(writtenFlags(), {0}); }); }