fix(search): tighten mock type cast for better type safety

Replace `as any` cast with `as unknown as ReturnType<typeof createMeiliClient>`
in the mock client factory. This preserves type safety without requiring the mock
to implement the full SDK interface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 23:53:32 +05:30
parent dfa289d6b8
commit 1d6e1fb4da
4 changed files with 1258 additions and 7 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import {
indexMessage,
deleteMessage,
MeiliDocument,
createMeiliClient,
} from './index';
function makeMockClient() {
@@ -15,7 +16,7 @@ function makeMockClient() {
addDocuments: mockAddDocuments,
deleteDocument: mockDeleteDocument,
});
return { client: { index: mockIndex } as any, mockIndex, mockUpdateSettings, mockAddDocuments, mockDeleteDocument };
return { client: { index: mockIndex } as unknown as ReturnType<typeof createMeiliClient>, mockIndex, mockUpdateSettings, mockAddDocuments, mockDeleteDocument };
}
describe('MESSAGES_INDEX', () => {