import { render, screen } from '@testing-library/react'; import { vi } from 'vitest'; import userEvent from '@testing-library/user-event'; import { AutomationTestingProps } from '@/types'; import { YAMLInspector } from './YAMLInspector'; vi.mock('@/react/hooks/useEnvironmentId', () => ({ useEnvironmentId: vi.fn(() => 1), })); vi.mock('@/react/portainer/environments/queries/useEnvironment', () => ({ useEnvironmentDeploymentOptions: vi.fn(() => ({ data: { hideWebEditor: false }, })), })); vi.mock('@/react/hooks/useUser', () => ({ useAuthorizations: vi.fn(() => ({ authorized: true })), })); vi.mock('@@/modals/confirm', () => ({ confirm: vi.fn(() => Promise.resolve(true)), buildConfirmButton: vi.fn((label) => ({ label })), })); vi.mock('./YAMLReplace/proxy/applyPatch', () => ({ applyPatch: vi.fn(() => Promise.resolve()), })); vi.mock('@@/Widget', () => ({ Loading: () =>
Loading
, })); vi.mock('@@/Alert', () => ({ Alert: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('@@/WebEditorForm', () => ({ WebEditorForm: ({ value, onChange, id, readonly, }: { value: string; onChange?: (value: string) => void; id: string; readonly?: boolean; }) => (