Files
buzz/mobile/test/features/channels/thread_reply_ownership_test.dart
Tom Brow a61239f0d8 fix(mobile): avoid opening empty threads on message tap (#7756)
Tapping a mobile channel message with no replies currently opens an
empty thread. Only enable message-row thread navigation when the
existing thread summary reports replies, including replies known to the
relay but not loaded locally. Long-press → Reply still starts a new
thread.

Added widget tests for zero replies, loaded replies, relay-only replies,
and starting a thread through Reply. The zero-reply test failed before
the fix and passes afterward.

Validation: all 227 channel-page tests, the full mobile pre-push checks,
and all PR CI checks passed. The full repository gate failed in
unchanged Rust ACP timing tests (idle reset, keepalive, and steering
deadlines); this PR changes only mobile Dart files.

No duplicate open PR or issue found.

---------

Signed-off-by: Tom Brow <tomb@block.xyz>
2026-09-21 08:51:05 -07:00

31 lines
880 B
Dart

import 'package:buzz/features/channels/thread_reply_ownership.dart';
import 'package:buzz/shared/relay/relay.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test(
'identity evidence is bounded while keeping recent evicted-payload owners',
() {
final owners = ThreadReplyOwnership();
owners.record([
for (var i = 0; i < 8193; i++)
NostrEvent(
id: 'reply-$i',
pubkey: 'author',
createdAt: i,
kind: EventKind.streamMessage,
tags: const [
['h', 'channel'],
['e', 'root', '', 'reply'],
],
content: '',
sig: '',
),
]);
expect(owners.rootFor('reply-0'), isNull);
expect(owners.rootFor('reply-1'), 'root');
expect(owners.rootFor('reply-8192'), 'root');
},
);
}