32 lines
821 B
TypeScript
32 lines
821 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
|
|
import { AgentWorkspaceShell } from '../../src/components/agent-workspace/agent-workspace-shell';
|
|
|
|
const { mockUseMutation, mockUseQuery } = vi.hoisted(() => ({
|
|
mockUseMutation: vi.fn(() => vi.fn()),
|
|
mockUseQuery: vi.fn(() => null),
|
|
}));
|
|
|
|
vi.mock('convex/react', () => ({
|
|
useMutation: mockUseMutation,
|
|
useQuery: mockUseQuery,
|
|
}));
|
|
|
|
vi.mock('sonner', () => ({
|
|
toast: {
|
|
error: vi.fn(),
|
|
success: vi.fn(),
|
|
},
|
|
}));
|
|
|
|
describe('AgentWorkspaceShell', () => {
|
|
it('renders a missing state when the job query returns null', () => {
|
|
render(<AgentWorkspaceShell jobId={'job-1' as never} />);
|
|
|
|
expect(
|
|
screen.getByText('This workspace was not found.'),
|
|
).toBeInTheDocument();
|
|
});
|
|
});
|