@@ -91,8 +91,8 @@ describe('OAuthStateClient', () => {
9191 expect ( mockUnsecuredSavedObjectsClient . create ) . toHaveBeenCalledWith (
9292 OAUTH_STATE_SAVED_OBJECT_TYPE ,
9393 expect . objectContaining ( {
94- state : expect . any ( String ) ,
95- codeVerifier : expect . any ( String ) ,
94+ state : expect . stringMatching ( / ^ [ A - Z a - z 0 - 9 _ - ] { 43 } $ / ) ,
95+ codeVerifier : expect . stringMatching ( / ^ [ A - Z a - z 0 - 9 _ - ] { 43 , 128 } $ / ) ,
9696 connectorId : 'connector-1' ,
9797 kibanaReturnUrl : 'https://kibana.example.com/app/connectors' ,
9898 spaceId : 'default' ,
@@ -103,21 +103,6 @@ describe('OAuthStateClient', () => {
103103 ) ;
104104 } ) ;
105105
106- it ( 'generates a codeVerifier within PKCE spec length (43-128 chars)' , async ( ) => {
107- const client = createClient ( ) ;
108- mockUnsecuredSavedObjectsClient . create . mockResolvedValue ( {
109- id : 'generated-id' ,
110- attributes : { } ,
111- } ) ;
112-
113- await client . create ( { connectorId : 'connector-1' , spaceId : 'default' } ) ;
114-
115- const { codeVerifier } = mockUnsecuredSavedObjectsClient . create . mock . calls [ 0 ] [ 1 ] ;
116- expect ( typeof codeVerifier ) . toBe ( 'string' ) ;
117- expect ( codeVerifier . length ) . toBeGreaterThanOrEqual ( 43 ) ;
118- expect ( codeVerifier . length ) . toBeLessThanOrEqual ( 128 ) ;
119- } ) ;
120-
121106 it ( 'includes createdBy when provided' , async ( ) => {
122107 const client = createClient ( ) ;
123108 mockUnsecuredSavedObjectsClient . create . mockResolvedValue ( {
0 commit comments