File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
client/src/components/__tests__ Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,25 @@ jest.mock("@/lib/auth", () => ({
7777 response_types : [ "code" ] ,
7878 client_name : "MCP Inspector" ,
7979 } ,
80- clientInformation : jest . fn ( ) ,
81- saveClientInformation : jest . fn ( ) ,
80+ clientInformation : jest . fn ( ) . mockImplementation ( async ( ) => {
81+ const serverUrl = "https://example.com/mcp" ;
82+ const preregisteredKey = `[${ serverUrl } ] ${ SESSION_KEYS . PREREGISTERED_CLIENT_INFORMATION } ` ;
83+ const preregisteredData = sessionStorage . getItem ( preregisteredKey ) ;
84+ if ( preregisteredData ) {
85+ return JSON . parse ( preregisteredData ) ;
86+ }
87+ const dynamicKey = `[${ serverUrl } ] ${ SESSION_KEYS . CLIENT_INFORMATION } ` ;
88+ const dynamicData = sessionStorage . getItem ( dynamicKey ) ;
89+ if ( dynamicData ) {
90+ return JSON . parse ( dynamicData ) ;
91+ }
92+ return undefined ;
93+ } ) ,
94+ saveClientInformation : jest . fn ( ) . mockImplementation ( ( clientInfo ) => {
95+ const serverUrl = "https://example.com/mcp" ;
96+ const key = `[${ serverUrl } ] ${ SESSION_KEYS . CLIENT_INFORMATION } ` ;
97+ sessionStorage . setItem ( key , JSON . stringify ( clientInfo ) ) ;
98+ } ) ,
8299 saveTokens : jest . fn ( ) ,
83100 redirectToAuthorization : jest . fn ( ) ,
84101 saveCodeVerifier : jest . fn ( ) ,
You can’t perform that action at this time.
0 commit comments