@@ -26,8 +26,10 @@ void main() {
26
26
27
27
test ('oauth_chopper returns interceptor which contains oauth_chopper' , () {
28
28
// arrange
29
- final oauthChopper =
30
- OAuthChopper (authorizationEndpoint: Uri .parse ('endpoint' ), identifier: 'identifier' , secret: 'secret' );
29
+ final oauthChopper = OAuthChopper (
30
+ authorizationEndpoint: Uri .parse ('endpoint' ),
31
+ identifier: 'identifier' ,
32
+ secret: 'secret' );
31
33
32
34
// act
33
35
final inteceptor = oauthChopper.interceptor;
@@ -38,8 +40,10 @@ void main() {
38
40
39
41
test ('oauth_chopper returns authenticator which contains oauth_chopper' , () {
40
42
// arrange
41
- final oauthChopper =
42
- OAuthChopper (authorizationEndpoint: Uri .parse ('endpoint' ), identifier: 'identifier' , secret: 'secret' );
43
+ final oauthChopper = OAuthChopper (
44
+ authorizationEndpoint: Uri .parse ('endpoint' ),
45
+ identifier: 'identifier' ,
46
+ secret: 'secret' );
43
47
44
48
// act
45
49
final authenticator = oauthChopper.authenticator ();
@@ -52,7 +56,10 @@ void main() {
52
56
// arrange
53
57
when (() => storageMock.fetchCredentials ()).thenAnswer ((_) => testJson);
54
58
final oauthChopper = OAuthChopper (
55
- authorizationEndpoint: Uri .parse ('endpoint' ), identifier: 'identifier' , secret: 'secret' , storage: storageMock);
59
+ authorizationEndpoint: Uri .parse ('endpoint' ),
60
+ identifier: 'identifier' ,
61
+ secret: 'secret' ,
62
+ storage: storageMock);
56
63
57
64
// act
58
65
final token = await oauthChopper.token;
@@ -67,7 +74,10 @@ void main() {
67
74
// arrange
68
75
when (() => storageMock.fetchCredentials ()).thenAnswer ((_) => null );
69
76
final oauthChopper = OAuthChopper (
70
- authorizationEndpoint: Uri .parse ('endpoint' ), identifier: 'identifier' , secret: 'secret' , storage: storageMock);
77
+ authorizationEndpoint: Uri .parse ('endpoint' ),
78
+ identifier: 'identifier' ,
79
+ secret: 'secret' ,
80
+ storage: storageMock);
71
81
72
82
// act
73
83
final token = await oauthChopper.token;
@@ -79,9 +89,13 @@ void main() {
79
89
test ("Successful grant is stored" , () async {
80
90
// arrange
81
91
when (() => storageMock.saveCredentials (any ())).thenAnswer ((_) => null );
82
- when (() => grantMock.handle (any (), any (), any ())).thenAnswer ((_) async => testJson);
92
+ when (() => grantMock.handle (any (), any (), any ()))
93
+ .thenAnswer ((_) async => testJson);
83
94
final oauthChopper = OAuthChopper (
84
- authorizationEndpoint: Uri .parse ('endpoint' ), identifier: 'identifier' , secret: 'secret' , storage: storageMock);
95
+ authorizationEndpoint: Uri .parse ('endpoint' ),
96
+ identifier: 'identifier' ,
97
+ secret: 'secret' ,
98
+ storage: storageMock);
85
99
86
100
// act
87
101
final token = await oauthChopper.requestGrant (grantMock);
@@ -90,7 +104,7 @@ void main() {
90
104
verify (() => grantMock.handle (any (), 'identifier' , 'secret' )).called (1 );
91
105
verify (() => storageMock.saveCredentials (testJson)).called (1 );
92
106
expect (token.accessToken, 'accesToken' );
93
- expect (token? .idToken, 'idToken' );
107
+ expect (token.idToken, 'idToken' );
94
108
expect (token.refreshToken, 'refreshToken' );
95
109
});
96
110
}
0 commit comments