import { describe, expect, test } from 'vitest' import { Type } from 'typebox' import { v } from 'suretype' import { extractJsonSchema } from './extract-json-schema.js' describe('extractJsonSchema()', () => { const typebox = Type.Object({ name: Type.String() }) const suretype = v.object({ name: v.string().required() }) test('it extracts TypeBox json-schema', async () => { expect(extractJsonSchema(typebox)).toMatchObject({ type: 'object', properties: { name: { type: 'string' } }, required: ['name'], }) }) test('it extracts Suretype json-schema', async () => { expect(extractJsonSchema(suretype)).toMatchObject({ type: 'object', properties: { name: { type: 'string' } }, required: ['name'], }) }) })