diff --git a/src/pages/Collections.test.jsx b/src/pages/Collections.test.jsx
new file mode 100644
index 000000000..5ff325a17
--- /dev/null
+++ b/src/pages/Collections.test.jsx
@@ -0,0 +1,93 @@
+import { render, screen, waitFor, fireEvent } from '@testing-library/react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import Collections from './Collections';
+
+const getCollections = vi.fn();
+const getAliases = vi.fn();
+const getCollection = vi.fn();
+const getApiKey = vi.fn();
+const client = {
+ getCollections,
+ getAliases,
+ getCollection,
+ getApiKey,
+};
+
+vi.mock('../context/client-context', () => ({
+ useClient: () => ({
+ client,
+ }),
+}));
+
+vi.mock('../context/telemetry-context', () => ({
+ useMaxCollections: () => ({ maxCollections: null }),
+}));
+
+vi.mock('../components/Collections/SearchBar', () => ({
+ default: ({ value, setValue }) => (
+ setValue(event.target.value)} />
+ ),
+}));
+
+vi.mock('../components/Collections/CollectionsList', () => ({
+ default: ({ collections }) => {collections.map((item) => item.name).join(',')}
,
+}));
+
+vi.mock('../components/Collections/CreateCollection/CreateCollectionButton', () => ({
+ default: () => ,
+}));
+
+vi.mock('../components/Snapshots/SnapshotsUpload', () => ({
+ SnapshotsUpload: () => ,
+}));
+
+vi.mock('../components/ToastNotifications/ErrorNotifier', () => ({
+ default: ({ message }) => {message}
,
+}));
+
+describe('Collections page size', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ localStorage.clear();
+
+ getCollections.mockResolvedValue({
+ collections: [{ name: 'alpha' }, { name: 'beta' }, { name: 'gamma' }],
+ });
+ getAliases.mockResolvedValue({ aliases: [] });
+ getCollection.mockImplementation(async (name) => ({ vectors_count: name.length }));
+ getApiKey.mockReturnValue(null);
+ });
+
+ it('fetches collections once on initial render', async () => {
+ render();
+
+ await screen.findByTestId('collections-list');
+
+ await waitFor(() => {
+ expect(getCollections).toHaveBeenCalledTimes(1);
+ });
+ });
+
+ it('falls back to the default page size when localStorage has an unsupported value', async () => {
+ localStorage.setItem('qdrant-web-ui-collections-page-size', '999');
+
+ render();
+
+ const pageSizeSelect = await screen.findByRole('combobox', { name: 'Collections per page' });
+ expect(pageSizeSelect).toHaveTextContent('5');
+ });
+
+ it('persists a newly selected page size', async () => {
+ render();
+
+ const pageSizeSelect = await screen.findByRole('combobox', { name: 'Collections per page' });
+ fireEvent.mouseDown(pageSizeSelect);
+
+ const option = await screen.findByRole('option', { name: '10' });
+ fireEvent.click(option);
+
+ await waitFor(() => {
+ expect(localStorage.getItem('qdrant-web-ui-collections-page-size')).toBe('10');
+ });
+ });
+});