File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,11 @@ const schema = {
2323 if ( ! runtimes . includes ( runtime as ( typeof runtimes ) [ number ] ) ) {
2424 return false ;
2525 }
26- if ( runtime === 'typescript' || runtime === 'python' ) {
26+ if (
27+ runtime === 'typescript' ||
28+ runtime === 'python' ||
29+ runtime === 'java'
30+ ) {
2731 const version = pathParts [ 2 ] ;
2832 const isValidSemver = / ^ \d + \. \d + \. \d + $ / . test ( version ) ;
2933 const isLatest = version === 'latest' ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ const tool = async (props: ToolProps): Promise<CallToolResult> => {
3737 logger . appendKeys ( { search, runtime, version } ) ;
3838
3939 const urlParts =
40- runtime === 'python' || runtime === 'typescript'
40+ runtime === 'python' || runtime === 'typescript' || runtime === 'java'
4141 ? [ runtime , version ]
4242 : [ runtime ] ;
4343 const baseUrl = `${ POWERTOOLS_BASE_URL } /${ urlParts . join ( '/' ) } ` ;
Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ describe('tool', () => {
7777 http . get ( `${ POWERTOOLS_BASE_URL } /dotnet/search/search_index.json` , ( ) =>
7878 HttpResponse . text ( 'Metrics is a feature of PowerTools for TypeScript.' )
7979 ) ,
80- http . get ( `${ POWERTOOLS_BASE_URL } /java/search/search_index.json` , ( ) =>
81- HttpResponse . text ( JSON . stringify ( { foo : [ ] } ) )
80+ http . get (
81+ `${ POWERTOOLS_BASE_URL } /java/latest/search/search_index.json` ,
82+ ( ) => HttpResponse . text ( JSON . stringify ( { foo : [ ] } ) )
8283 ) ,
8384 http . get (
8485 `${ POWERTOOLS_BASE_URL } /python/latest/search/search_index.json` ,
@@ -167,14 +168,14 @@ describe('tool', () => {
167168
168169 // Act
169170 const result = await tool ( {
170- version : '' ,
171+ version : 'latest ' ,
171172 runtime : 'java' ,
172173 search : 'log buffering' ,
173174 } ) ;
174175
175176 // Assess
176177 expect ( result . content ) . toBeResponseWithText (
177- `Failed to fetch search index for java : Invalid search index format for java : missing 'docs' property`
178+ `Failed to fetch search index for java latest : Invalid search index format for java latest : missing 'docs' property`
178179 ) ;
179180 expect ( result . isError ) . toBe ( true ) ;
180181 } ) ;
You can’t perform that action at this time.
0 commit comments