fix(app): handle nullable detail consumers

This commit is contained in:
Gabriel Brown
2026-07-10 17:24:32 -04:00
parent ed21126eea
commit 2beeeb1732
4 changed files with 103 additions and 2 deletions
@@ -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();
});
});