11// 📦 Package imports:
22import 'package:dio/dio.dart' ;
33import 'package:mocktail/mocktail.dart' ;
4- import 'package:test/test.dart' ;
5-
64// 🌎 Project imports:
75import 'package:passputter/src/oauth_api_impl.dart' ;
86import 'package:passputter/src/oauth_token.dart' ;
7+ import 'package:test/test.dart' ;
98
109class MockDio extends Mock implements Dio {}
1110
@@ -28,7 +27,7 @@ void main() {
2827 group ('getClientToken' , () {
2928 test ('successfully returns token' , () async {
3029 when (
31- () => dio.post (
30+ () => dio.post < String > (
3231 endpoint,
3332 data: < String , String > {
3433 'client_id' : clientId,
@@ -41,10 +40,12 @@ void main() {
4140 (_) async => Response (
4241 requestOptions: RequestOptions (path: endpoint),
4342 statusCode: 200 ,
44- data: '''{
43+ data: '''
44+ {
4545 "access_token": "token",
4646 "refresh_token": "refresh"
47- }''' ,
47+ }
48+ ''' ,
4849 ),
4950 );
5051
@@ -64,7 +65,7 @@ void main() {
6465
6566 test ('throws DioError if one is thrown by request' , () async {
6667 when (
67- () => dio.post (
68+ () => dio.post < String > (
6869 endpoint,
6970 data: < String , String > {
7071 'client_id' : clientId,
@@ -76,7 +77,7 @@ void main() {
7677 ).thenAnswer ((_) => Future .error (tError));
7778
7879 expect (
79- () async => await oAuthApi.getClientToken (
80+ () async => oAuthApi.getClientToken (
8081 clientId: clientId,
8182 clientSecret: clientSecret,
8283 ),
@@ -90,7 +91,7 @@ void main() {
9091
9192 test ('successfully returns token' , () async {
9293 when (
93- () => dio.post (
94+ () => dio.post < String > (
9495 endpoint,
9596 data: < String , String > {
9697 'refresh_token' : refreshToken,
@@ -104,10 +105,12 @@ void main() {
104105 (_) async => Response (
105106 requestOptions: RequestOptions (path: endpoint),
106107 statusCode: 200 ,
107- data: '''{
108+ data: '''
109+ {
108110 "access_token": "token",
109111 "refresh_token": "refresh"
110- }''' ,
112+ }
113+ ''' ,
111114 ),
112115 );
113116
@@ -128,7 +131,7 @@ void main() {
128131
129132 test ('throws DioError if one is thrown by request' , () async {
130133 when (
131- () => dio.post (
134+ () => dio.post < String > (
132135 endpoint,
133136 data: < String , String > {
134137 'refresh_token' : refreshToken,
@@ -141,7 +144,7 @@ void main() {
141144 ).thenAnswer ((_) => Future .error (tError));
142145
143146 expect (
144- () async => await oAuthApi.getRefreshedToken (
147+ () async => oAuthApi.getRefreshedToken (
145148 refreshToken: refreshToken,
146149 clientId: clientId,
147150 clientSecret: clientSecret,
@@ -157,7 +160,7 @@ void main() {
157160
158161 test ('successfully returns token' , () async {
159162 when (
160- () => dio.post (
163+ () => dio.post < String > (
161164 endpoint,
162165 data: < String , String > {
163166 'username' : username,
@@ -172,10 +175,12 @@ void main() {
172175 (_) async => Response (
173176 requestOptions: RequestOptions (path: endpoint),
174177 statusCode: 200 ,
175- data: '''{
178+ data: '''
179+ {
176180 "access_token": "token",
177181 "refresh_token": "refresh"
178- }''' ,
182+ }
183+ ''' ,
179184 ),
180185 );
181186
@@ -197,7 +202,7 @@ void main() {
197202
198203 test ('throws DioError if one is thrown by request' , () async {
199204 when (
200- () => dio.post (
205+ () => dio.post < String > (
201206 endpoint,
202207 data: < String , String > {
203208 'username' : username,
@@ -211,7 +216,7 @@ void main() {
211216 ).thenAnswer ((_) => Future .error (tError));
212217
213218 expect (
214- () async => await oAuthApi.getUserToken (
219+ () async => oAuthApi.getUserToken (
215220 username: username,
216221 password: password,
217222 clientId: clientId,
0 commit comments