1
1
import fastify from 'fastify' ;
2
2
import { expectAssignable , expectError , expectType } from 'tsd' ;
3
- import fastifyOauth2 , { Credentials , OAuth2Namespace , OAuth2Token , ProviderConfiguration } from '../..' ;
3
+ import fastifyOauth2 , { FastifyOAuth2Options , Credentials , OAuth2Namespace , OAuth2Token , ProviderConfiguration } from '../..' ;
4
4
5
5
/**
6
6
* Preparing some data for testing.
@@ -15,7 +15,7 @@ const credentials: Credentials = {
15
15
} ,
16
16
auth : auth ,
17
17
} ;
18
- const OAuth2Options = {
18
+ const OAuth2Options : FastifyOAuth2Options = {
19
19
name : 'testOAuthName' ,
20
20
scope : scope ,
21
21
credentials : credentials ,
@@ -30,6 +30,23 @@ const server = fastify();
30
30
31
31
server . register ( fastifyOauth2 , OAuth2Options ) ;
32
32
33
+ server . register ( fastifyOauth2 , {
34
+ name : 'testOAuthName' ,
35
+ scope : scope ,
36
+ credentials : credentials ,
37
+ callbackUri : 'http://localhost/testOauth/callback' ,
38
+ checkStateFunction : ( ) => { } ,
39
+ } )
40
+
41
+ expectError ( server . register ( fastifyOauth2 , {
42
+ name : 'testOAuthName' ,
43
+ scope : scope ,
44
+ credentials : credentials ,
45
+ callbackUri : 'http://localhost/testOauth/callback' ,
46
+ checkStateFunction : ( ) => { } ,
47
+ startRedirectPath : 2 ,
48
+ } ) )
49
+
33
50
declare module 'fastify' {
34
51
// Developers need to define this in their code like they have to do with all decorators.
35
52
interface FastifyInstance {
0 commit comments