@@ -123,18 +123,34 @@ describe('handler', () => {
123
123
} )
124
124
} )
125
125
126
- describe ( 'missing provider' , ( ) => {
126
+ describe ( 'missing provider + missing callback ' , ( ) => {
127
127
; [ 'express' , 'koa' , 'hapi' , 'fastify' , 'node' , 'aws' , 'azure' , 'gcloud' , 'vercel' ] . forEach ( ( handler ) => {
128
128
describe ( handler , ( ) => {
129
129
before ( async ( ) => {
130
- client = await Client ( { test : 'handlers' , handler, config} )
130
+ client = await Client ( {
131
+ test : 'handlers' ,
132
+ handler,
133
+ config : {
134
+ defaults : { origin : config . defaults . origin } , // no callback!
135
+ oauth2 : config . oauth2
136
+ }
137
+ } )
131
138
} )
132
139
133
140
after ( async ( ) => {
134
141
await client . close ( )
135
142
} )
136
143
137
- it ( '/connect - misconfigured provider' , async ( ) => {
144
+ it ( '/connect - missing provider' , async ( ) => {
145
+ t . equal ( config . defaults . dynamic , undefined )
146
+ var { body : { response} } = await request ( {
147
+ url : client . url ( '/connect/oauth5' ) ,
148
+ cookie : { } ,
149
+ } )
150
+ t . deepEqual ( response , { error : 'Grant: missing or misconfigured provider' } )
151
+ } )
152
+
153
+ it ( '/connect - unsupported oauth version' , async ( ) => {
138
154
var { body : { response} } = await request ( {
139
155
url : client . url ( '/connect/oauth2' ) ,
140
156
qs : { oauth : 5 } ,
@@ -143,13 +159,22 @@ describe('handler', () => {
143
159
t . deepEqual ( response , { error : 'Grant: missing or misconfigured provider' } )
144
160
} )
145
161
146
- it ( '/connect - missing provider' , async ( ) => {
147
- t . equal ( config . defaults . dynamic , undefined )
162
+ it ( '/connect - authorize error' , async ( ) => {
148
163
var { body : { response} } = await request ( {
149
- url : client . url ( '/connect/oauth5' ) ,
164
+ url : client . url ( '/connect/oauth2' ) ,
165
+ qs : { authorize_url : provider . url ( '/authorize_error_message' ) } ,
150
166
cookie : { } ,
151
167
} )
152
- t . deepEqual ( response , { error : 'Grant: missing or misconfigured provider' } )
168
+ t . deepEqual ( response , { error : { message : 'invalid' } } )
169
+ } )
170
+
171
+ it ( '/connect - access error' , async ( ) => {
172
+ var { body : { response} } = await request ( {
173
+ url : client . url ( '/connect/oauth2' ) ,
174
+ qs : { access_url : provider . url ( '/access_error_status' ) } ,
175
+ cookie : { } ,
176
+ } )
177
+ t . deepEqual ( response , { error : { invalid : 'access_url' } } )
153
178
} )
154
179
155
180
it ( '/callback - missing session' , async ( ) => {
0 commit comments