@@ -15,43 +15,49 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
1515import '../../shared/community/community_storage_test.dart' ;
1616
1717void main () {
18- testWidgets ('hosted handler drains queued links without legacy generation' , (
19- tester,
20- ) async {
21- const first = AddCommunityDeepLink (
22- relayUrl: 'wss://one.communities.buzz.xyz' ,
23- name: 'One' ,
24- );
25- const second = InviteDeepLink (
26- relayUrl: 'wss://two.communities.buzz.xyz' ,
27- code: 'invite' ,
28- );
29- final pending = _QueuedPendingDeepLinkNotifier ([first, second]);
30- final handled = < BuzzDeepLink > [];
31- await tester.pumpWidget (
32- ProviderScope (
33- overrides: [
34- pendingDeepLinkProvider.overrideWith (() => pending),
35- inviteKeyGeneratorProvider.overrideWithValue (
36- () => throw StateError ('must not generate' ),
37- ),
38- ],
39- child: MaterialApp (
40- home: DeepLinkDispatcher (
41- dispatchMessageLinks: false ,
42- onboardingHandler: (_, link) async {
43- handled.add (link);
44- return true ;
45- },
46- child: const Scaffold (body: SizedBox ()),
18+ for (final outcome in ['handled' , 'declined' , 'failed' ]) {
19+ testWidgets ('hosted handler drains queued links after $outcome setup' , (
20+ tester,
21+ ) async {
22+ const first = AddCommunityDeepLink (
23+ relayUrl: 'wss://one.communities.buzz.xyz' ,
24+ name: 'One' ,
25+ );
26+ const second = InviteDeepLink (
27+ relayUrl: 'wss://two.communities.buzz.xyz' ,
28+ code: 'invite' ,
29+ );
30+ final pending = _QueuedPendingDeepLinkNotifier ([first, second]);
31+ final handled = < BuzzDeepLink > [];
32+ await tester.pumpWidget (
33+ ProviderScope (
34+ overrides: [
35+ pendingDeepLinkProvider.overrideWith (() => pending),
36+ inviteKeyGeneratorProvider.overrideWithValue (
37+ () => throw StateError ('must not generate' ),
38+ ),
39+ ],
40+ child: MaterialApp (
41+ home: DeepLinkDispatcher (
42+ dispatchMessageLinks: false ,
43+ onboardingHandler: (_, link) async {
44+ handled.add (link);
45+ if (link == first) {
46+ if (outcome == 'declined' ) return false ;
47+ if (outcome == 'failed' ) throw StateError ('setup failed' );
48+ }
49+ return true ;
50+ },
51+ child: const Scaffold (body: SizedBox ()),
52+ ),
4753 ),
4854 ),
49- ),
50- );
51- await tester. pumpAndSettle ( );
52- expect (handled, [first, second] );
53- expect (pending.consumeCalls, 2 );
54- });
55+ );
56+ await tester. pumpAndSettle ( );
57+ expect (handled, [first, second] );
58+ expect (pending.consumeCalls, 2 );
59+ } );
60+ }
5561 testWidgets ('queues deep links in arrival order until acknowledged' , (
5662 tester,
5763 ) async {
0 commit comments