@@ -192,12 +192,35 @@ describe('spec-schema-access transform', () => {
192192 expect ( result . changesCount ) . toBe ( 0 ) ;
193193 } ) ;
194194
195- it ( 'expands shorthand property assignment' , ( ) => {
195+ it ( 'expands shorthand property assignment and removes import ' , ( ) => {
196196 const input = [ `import { ToolSchema } from '@modelcontextprotocol/server';` , `const schemas = { ToolSchema };` , '' ] . join ( '\n' ) ;
197197 const { text, result } = applyTransform ( input ) ;
198- expect ( text ) . toContain ( 'ToolSchema: specTypeSchemas.Tool' ) ;
198+ expect ( text ) . toContain ( "'ToolSchema': specTypeSchemas.Tool" ) ;
199+ expect ( text ) . not . toMatch ( / i m p o r t \s * \{ [ ^ } ] * T o o l S c h e m a [ ^ } ] * \} / ) ;
199200 expect ( result . changesCount ) . toBeGreaterThan ( 0 ) ;
200201 } ) ;
202+
203+ it ( 'skips PropertyAssignment name-node (non-shorthand)' , ( ) => {
204+ const input = [
205+ `import { ToolSchema } from '@modelcontextprotocol/server';` ,
206+ `const schemas = { ToolSchema: myValidator };` ,
207+ ''
208+ ] . join ( '\n' ) ;
209+ const { text, result } = applyTransform ( input ) ;
210+ expect ( text ) . toContain ( 'ToolSchema: myValidator' ) ;
211+ expect ( result . changesCount ) . toBe ( 0 ) ;
212+ } ) ;
213+
214+ it ( 'skips BindingElement property-name' , ( ) => {
215+ const input = [
216+ `import { ToolSchema } from '@modelcontextprotocol/server';` ,
217+ `const { ToolSchema: local } = obj;` ,
218+ ''
219+ ] . join ( '\n' ) ;
220+ const { text, result } = applyTransform ( input ) ;
221+ expect ( text ) . toContain ( 'ToolSchema: local' ) ;
222+ expect ( result . changesCount ) . toBe ( 0 ) ;
223+ } ) ;
201224 } ) ;
202225
203226 describe ( 'aliased imports' , ( ) => {
0 commit comments