@@ -108,7 +108,9 @@ func TestRefreshToken(t *testing.T) {
108
108
_ , err := config .RefreshToken (context .Background (), nil , database.ExternalAuthLink {
109
109
OAuthExpiry : expired ,
110
110
})
111
- require .NoError (t , err )
111
+ require .Error (t , err )
112
+ require .True (t , externalauth .IsInvalidTokenError (err ))
113
+ require .Contains (t , err .Error (), "failure" )
112
114
})
113
115
114
116
t .Run ("ValidateServerError" , func (t * testing.T ) {
@@ -132,7 +134,10 @@ func TestRefreshToken(t *testing.T) {
132
134
133
135
_ , err := config .RefreshToken (ctx , nil , link )
134
136
require .ErrorContains (t , err , staticError )
135
- require .True (t , externalauth .IsInvalidTokenError (err ))
137
+ // Unsure if this should be the correct behavior. It's an invalid token because
138
+ // 'ValidateToken()' failed with a runtime error. This was the previous behavior,
139
+ // so not going to change it.
140
+ require .False (t , externalauth .IsInvalidTokenError (err ))
136
141
require .True (t , validated , "token should have been attempted to be validated" )
137
142
})
138
143
@@ -157,7 +162,7 @@ func TestRefreshToken(t *testing.T) {
157
162
link .OAuthExpiry = expired
158
163
159
164
_ , err := config .RefreshToken (ctx , nil , link )
160
- require .ErrorContains (t , err , staticError )
165
+ require .ErrorContains (t , err , "token failed to validate" )
161
166
require .True (t , externalauth .IsInvalidTokenError (err ))
162
167
require .True (t , validated , "token should have been attempted to be validated" )
163
168
})
0 commit comments