fork of hey-api/openapi-ts because I need some additional things

Improve shorthand patch test to better demonstrate behavior

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+8 -7
+8 -7
packages/shared/src/openApi/shared/utils/__tests__/patch.test.ts
··· 290 290 expect(spec.info.title).toBe('Modified Title'); 291 291 }); 292 292 293 - it('shorthand function prevents other patches from running', () => { 294 - const metaFn = vi.fn(); 295 - const schemasFn = vi.fn(); 293 + it('shorthand function replaces object-based patch configuration', () => { 296 294 const spec: OpenApi.V3_1_X = { 297 295 ...specMetadataV3, 298 296 components: { ··· 304 302 }, 305 303 }; 306 304 305 + // When using shorthand syntax, only the function is called 306 + // Object properties like meta or schemas would be ignored 307 307 patchOpenApiSpec({ 308 - patchOptions: ((spec) => { 308 + patchOptions: (spec) => { 309 309 spec.info.title = 'Shorthand Title'; 310 - }) as any, 310 + // This is the only code that runs 311 + }, 311 312 spec, 312 313 }); 313 314 314 315 expect(spec.info.title).toBe('Shorthand Title'); 315 - expect(metaFn).not.toHaveBeenCalled(); 316 - expect(schemasFn).not.toHaveBeenCalled(); 316 + // Schemas remain untouched since no schema patch was applied 317 + expect(spec.components?.schemas?.Foo).toEqual({ type: 'string' }); 317 318 }); 318 319 }); 319 320