1
1
import 'package:app_links/app_links.dart' ;
2
- import 'package:flutter/services.dart' ;
3
2
import 'package:flutter_test/flutter_test.dart' ;
4
3
import 'package:supabase_flutter/supabase_flutter.dart' ;
5
4
@@ -95,7 +94,6 @@ void main() {
95
94
96
95
group ('Deep Link with PKCE code' , () {
97
96
late final PkceHttpClient pkceHttpClient;
98
- late final EventChannel appLinksEventChannel;
99
97
late final bool mockEventChannel;
100
98
101
99
/// Check if the current version of AppLinks uses an explicit call to get
@@ -119,7 +117,7 @@ void main() {
119
117
// getting the initial link. Otherwise we want to mock the event channel
120
118
// and put the initial link there.
121
119
mockEventChannel = appLinksExposesInitialLinkInStream ();
122
- appLinksEventChannel = mockAppLink (
120
+ mockAppLink (
123
121
mockMethodChannel: ! mockEventChannel,
124
122
mockEventChannel: mockEventChannel,
125
123
initialLink: 'com.supabase://callback/?code=my-code-verifier' ,
@@ -142,10 +140,10 @@ void main() {
142
140
test (
143
141
'Having `code` as the query parameter triggers `getSessionFromUrl` call on initialize' ,
144
142
() async {
145
- // Wait for the initial app link to be handled, as this is an async process
143
+ // Wait for the initial app link to be handled, as this is an async
144
+ // process when mocking the event channel.
146
145
if (mockEventChannel) {
147
- final stream = appLinksEventChannel.receiveBroadcastStream ();
148
- await stream.first;
146
+ await AppLinks ().uriLinkStream.first;
149
147
}
150
148
expect (pkceHttpClient.requestCount, 1 );
151
149
expect (pkceHttpClient.lastRequestBody['auth_code' ], 'my-code-verifier' );
0 commit comments