fix: pages feature now works properly

This commit is contained in:
2026-02-16 08:15:02 +01:00
parent 9440c5e543
commit 9bab8ac89c
4 changed files with 139 additions and 10 deletions

View File

@@ -2175,6 +2175,19 @@ Published content`);
const result = await postEngine.searchPosts('nonexistent');
expect(result).toEqual([]);
});
it('should cap search results at 500', async () => {
mockLocalClient.execute.mockResolvedValueOnce({ rows: [] });
await postEngine.searchPosts('term');
expect(mockLocalClient.execute).toHaveBeenCalled();
const call = vi.mocked(mockLocalClient.execute).mock.calls[0]?.[0] as { sql?: string } | undefined;
expect(call?.sql).toBeDefined();
const sql = call?.sql?.toLowerCase() ?? '';
expect(sql).toContain('limit 500');
expect(sql).not.toMatch(/\blimit\s+50\b/);
});
});
describe('getTagsWithCounts', () => {