Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: pin picker truncation/search copy and remix by-id 404 and retry paths (#12996)

[._.]/ Adam Eivycbf3bfc1c5e1
diff --git a/client/src/components/videoGen/GalleryVideoPicker.test.jsx b/client/src/components/videoGen/GalleryVideoPicker.test.jsx
index 8f6deda9dc..5ffe79bc28 100644
--- a/client/src/components/videoGen/GalleryVideoPicker.test.jsx
+++ b/client/src/components/videoGen/GalleryVideoPicker.test.jsx
@@ -66,6 +66,28 @@ describe('GalleryVideoPicker', () => {
}));
});
+ it('says only the newest page is shown, and refines the copy during a search', async () => {
+ const full = Array.from({ length: 60 }, (_, i) => ({ ...HISTORY[0], id: `id-${i}`, filename: `v${i}.mp4`, prompt: `clip ${i}` }));
+ listVideoHistory.mockResolvedValue(full);
+ render(<GalleryVideoPicker open onClose={vi.fn()} onSelect={vi.fn()} />);
+ expect(await screen.findByText(/Showing the newest 60 videos/)).toBeInTheDocument();
+ fireEvent.change(screen.getByLabelText('Search videos'), { target: { value: 'clip' } });
+ expect(await screen.findByText(/Showing the first 60 matches/)).toBeInTheDocument();
+ });
+
+ it('shows no-match copy for an empty search and Clear search refetches with an empty query', async () => {
+ render(<GalleryVideoPicker open onClose={vi.fn()} onSelect={vi.fn()} />);
+ await screen.findByText('a neon chase');
+ listVideoHistory.mockResolvedValue([]);
+ fireEvent.change(screen.getByLabelText('Search videos'), { target: { value: 'zzz' } });
+ expect(await screen.findByText('No videos match your search.')).toBeInTheDocument();
+ listVideoHistory.mockResolvedValue(HISTORY);
+ fireEvent.click(screen.getByRole('button', { name: 'Clear search' }));
+ await waitFor(() => expect(listVideoHistory).toHaveBeenLastCalledWith({
+ silent: true, query: { limit: 60, compact: true, hidden: false, q: '' },
+ }));
+ });
+
it('shows a load error with Retry instead of the empty copy when the history read fails', async () => {
listVideoHistory.mockRejectedValueOnce(new Error('History unavailable'));
render(<GalleryVideoPicker open onClose={vi.fn()} onSelect={vi.fn()} />);
diff --git a/client/src/pages/VideoGen.remix.test.jsx b/client/src/pages/VideoGen.remix.test.jsx
index a41359fdc4..dba90d27c4 100644
--- a/client/src/pages/VideoGen.remix.test.jsx
+++ b/client/src/pages/VideoGen.remix.test.jsx
@@ -201,6 +201,24 @@ describe('VideoGen cross-page Remix handoff', () => {
expect(screen.queryByText(/no longer in your history/)).toBeNull();
});
+ it('reports a missing record when the by-id lookup answers 404', async () => {
+ state.listVideoHistory.mockResolvedValue([]);
+ state.getVideoHistoryItem.mockRejectedValue(Object.assign(new Error('Not found'), { status: 404 }));
+ await renderVideoGenPage('/media/video?remix=vid-gone');
+ await screen.findByText(/no longer in your history/);
+ expect(screen.queryByRole('button', { name: 'Retry' })).toBeNull();
+ });
+
+ it('offers Retry after a non-404 by-id failure and restores once it succeeds', async () => {
+ state.listVideoHistory.mockResolvedValue([]);
+ state.getVideoHistoryItem
+ .mockRejectedValueOnce(Object.assign(new Error('Server error'), { status: 500 }))
+ .mockResolvedValue(RECORD);
+ await renderVideoGenPage(`/media/video?remix=${RECORD.id}`);
+ await act(async () => { fireEvent.click(await screen.findByRole('button', { name: 'Retry' })); });
+ await waitFor(() => expect(screen.getByLabelText('Prompt')).toHaveValue(RECORD.prompt));
+ });
+
it('says nothing about a missing record while the history fetch is still in flight', async () => {
let settleHistory;
state.listVideoHistory.mockReturnValue(new Promise((resolve) => { settleHistory = resolve; }));