fix(app): handle nullable detail consumers
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user