import * as React from 'react' import { render, screen, fireEvent, waitFor } from '@testing-library/react' import { Form } from 'react-final-form' import { describe, it, expect, vi, beforeEach } from 'vitest' import ApiKeyInput from './ApiKeyInput' const hooks = vi.hoisted(() => ({ notify: vi.fn() })) const KEY = 'nds_0123456789abcdefghijkl' const KEY_FORMAT = /^nds_[0-9A-Za-z]{22}$/ vi.mock('react-admin', async () => { const actual = await vi.importActual('react-admin') return { ...actual, useNotify: () => hooks.notify, useTranslate: () => (key) => key, } }) const renderInput = ({ record, initialValues = {}, isCreate = false, fullWidth, }) => { let values const utils = render(