/** * @vitest-environment jsdom */ import * as React from 'react'; import create from 'zustand'; import { describe, it, expect, vitest, afterEach } from 'vitest'; import { StateContext, SwitchErrorInfo } from 'piral-core'; import { render, cleanup } from '@testing-library/react'; import './types'; const FormErrorInfo = () =>
; const mockState = { state: create(() => ({ errorComponents: { form: FormErrorInfo, }, registry: { extensions: {}, }, })), }; vitest.mock('react', async () => ({ ...((await vitest.importActual('react')) as any), useMemo: (cb) => cb(), })); describe('Extended Error Info Component for Forms', () => { afterEach(() => { cleanup(); }); it('renders the switch-case in the form error case', () => { const node = render(