Merge pull request #1254 from OffbandMesh/test/1253-remote-cli-flaky

test(#1253): check the Remote CLI flag byte, not the timestamped frame
pull/1279/head
Strycher 3 days ago committed by GitHub
commit e4b006bef9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -108,11 +108,12 @@ void main() {
);
}
bool wrote(Uint8List frame) => sent.any(
(f) =>
f.length == frame.length &&
Iterable<int>.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<int> 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});
});
}

Loading…
Cancel
Save

Powered by TurnKey Linux.