import { render, screen } from '@testing-library/react'; import user from '@testing-library/user-event'; import { type } from 'arktype'; import React from 'react'; import { useForm } from 'react-hook-form'; import { standardSchemaResolver } from '..'; const schema = type({ username: 'string>1', password: 'string>1', }); function TestComponent({ onSubmit, }: { onSubmit: (data: typeof schema.infer) => void; }) { const { register, handleSubmit, formState: { errors }, } = useForm({ resolver: standardSchemaResolver(schema), // Useful to check TypeScript regressions }); return (
); } test("form's validation with arkType and TypeScript's integration", async () => { const handleSubmit = vi.fn(); render(