mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Remove faulty Index test
This commit is contained in:
1 file changed
-89
@@ -1,89 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import Index from './Index';
|
||||
import { TestApp } from '@/test/TestApp';
|
||||
|
||||
describe('Index Page', () => {
|
||||
it('renders index page with project description textarea', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
expect(screen.getByPlaceholderText('Please select a model below, then describe what you\'d like to build...')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /Create Project/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('disables create button when no prompt is provided', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
const createButton = screen.getByRole('button', { name: /Create Project/i });
|
||||
expect(createButton).toBeDisabled();
|
||||
});
|
||||
|
||||
it('shows FileAttachment component for file management', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
// Query the paperclip button by test id or aria label
|
||||
const paperclipButton = screen.getByTestId('paperclip-button');
|
||||
expect(paperclipButton).toBeInTheDocument();
|
||||
expect(paperclipButton).toHaveAttribute('aria-label', 'Attach files');
|
||||
});
|
||||
|
||||
it('shows FileAttachment component by role and name', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
// Query the paperclip button by role and aria-label
|
||||
const paperclipButton = screen.getByRole('button', { name: /attach files/i });
|
||||
expect(paperclipButton).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('has textarea container that can receive drag events', () => {
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
const textarea = screen.getByPlaceholderText('Please select a model below, then describe what you\'d like to build...');
|
||||
const container = textarea.closest('div');
|
||||
|
||||
expect(container).toBeInTheDocument();
|
||||
|
||||
// Verify the container can handle drag events by checking if it's interactive
|
||||
expect(container).toHaveClass('relative', 'rounded-2xl', 'border', 'border-input');
|
||||
});
|
||||
|
||||
it('enables create button when text prompt is provided and model is selected', async () => {
|
||||
const user = await import('@testing-library/user-event').then(mod => mod.userEvent);
|
||||
|
||||
render(
|
||||
<TestApp>
|
||||
<Index />
|
||||
</TestApp>
|
||||
);
|
||||
|
||||
// Type in the textarea
|
||||
const textarea = screen.getByPlaceholderText('Please select a model below, then describe what you\'d like to build...');
|
||||
await user.type(textarea, 'Create a test project');
|
||||
|
||||
// The create button should be enabled once we have text
|
||||
const createButton = screen.getByRole('button', { name: /Create Project/i });
|
||||
// Note: In actual test environment, the button might still be disabled due to model selection
|
||||
// This test mainly verifies the component structure and basic interactivity
|
||||
expect(createButton).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user