Files
buzz/mobile/test/shared/deeplink/deep_link_test.dart
Tom Brow 37f65c08dc fix(mobile): handle buzz:// links (#1826)
Signed-off-by: Tom Brow <tomb@block.xyz>
Signed-off-by: npub1shglkdhngx3hrnhf4gf8vhpqdrmeludctechdvpwd3988zzs7ncq2cmtxu <85d1fb36f341a371cee9aa12765c2068f79ff1b85e7176b02e6c4a738850f4f0@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Goose <opensource@block.xyz>
Co-authored-by: npub1shglkdhngx3hrnhf4gf8vhpqdrmeludctechdvpwd3988zzs7ncq2cmtxu <85d1fb36f341a371cee9aa12765c2068f79ff1b85e7176b02e6c4a738850f4f0@sprout-oss.stage.blox.sqprod.co>
2026-07-14 16:00:13 -07:00

64 lines
1.7 KiB
Dart

import 'package:buzz/shared/deeplink/deep_link.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('parseMessageDeepLink', () {
test('parses channel and id', () {
final link = parseMessageDeepLink(
Uri.parse('buzz://message?channel=d14cd131&id=abc123'),
);
expect(
link,
const MessageDeepLink(channelId: 'd14cd131', messageId: 'abc123'),
);
});
test('parses optional thread param', () {
final link = parseMessageDeepLink(
Uri.parse('buzz://message?channel=d14cd131&id=abc123&thread=root99'),
);
expect(link?.threadRootId, 'root99');
});
test('treats empty thread as absent', () {
final link = parseMessageDeepLink(
Uri.parse('buzz://message?channel=d14cd131&id=abc123&thread='),
);
expect(link, isNotNull);
expect(link?.threadRootId, isNull);
});
test('rejects missing channel', () {
expect(parseMessageDeepLink(Uri.parse('buzz://message?id=abc')), isNull);
});
test('rejects empty channel', () {
expect(
parseMessageDeepLink(Uri.parse('buzz://message?channel=&id=abc')),
isNull,
);
});
test('rejects missing id', () {
expect(
parseMessageDeepLink(Uri.parse('buzz://message?channel=d14cd131')),
isNull,
);
});
test('rejects non-buzz scheme', () {
expect(
parseMessageDeepLink(Uri.parse('https://message?channel=a&id=b')),
isNull,
);
});
test('rejects non-message host (connect is desktop-only)', () {
expect(
parseMessageDeepLink(Uri.parse('buzz://connect?relay=wss://x')),
isNull,
);
});
});
}