Files
gitbook/packages/openapi-parser/src/v2.test.ts
T
2026-08-13 13:18:42 +00:00

18 lines
629 B
TypeScript

import { describe, expect, it } from 'bun:test';
import { convertOpenAPIV2ToOpenAPIV3 } from './v2';
const specV2 = await Bun.file(new URL('./fixtures/spec-v2.json', import.meta.url)).text();
describe('#convertOpenAPIV2ToOpenAPIV3', () => {
it('converts an OpenAPIV2 in V3', async () => {
const result = await convertOpenAPIV2ToOpenAPIV3({
value: specV2,
rootURL: null,
});
// Ensure the structure returned is not recursive (not dereferenced).
JSON.stringify(result.filesystem);
expect(result.filesystem[0]?.specification.openapi).toBe('3.1.1');
});
});