Skip to content

Commit 238200b

Browse files
committed
Make test more consistent with the rest, add locales type to SearchRequestGET
1 parent d44a2d6 commit 238200b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/types/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export type HybridSearch = {
108108
semanticRatio?: number;
109109
};
110110

111-
// @TODO: Add documentation link to available locales
111+
// https://www.meilisearch.com/docs/reference/api/settings#localized-attributes
112112
export type Locale = string;
113113

114114
export type SearchParams = Query &
@@ -156,6 +156,7 @@ export type SearchRequestGET = Pagination &
156156
rankingScoreThreshold?: number;
157157
distinct?: string;
158158
retrieveVectors?: boolean;
159+
locales?: Locale[];
159160
};
160161

161162
export type MultiSearchQuery = SearchParams & { indexUid: string };

tests/search.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -993,19 +993,18 @@ describe.each([
993993
).rejects.toHaveProperty('cause.code', ErrorStatusCode.INDEX_NOT_FOUND);
994994
});
995995

996-
test(`${permission} key: Search with locales`, async () => {
997-
const localIndex = (await getClient(permission)).index(index.uid);
998-
const localMasterIndex = (await getClient('Master')).index(index.uid);
996+
test.only(`${permission} key: Search with locales`, async () => {
997+
const client = await getClient(permission);
998+
const masterClient = await getClient('Master');
999999

1000-
const updateLocalizedAttributesEnqueuedTask =
1001-
await localMasterIndex.updateLocalizedAttributes([
1000+
const { taskUid } = await masterClient
1001+
.index(index.uid)
1002+
.updateLocalizedAttributes([
10021003
{ attributePatterns: ['title', 'comment'], locales: ['fra', 'eng'] },
10031004
]);
1004-
await localMasterIndex.waitForTask(
1005-
updateLocalizedAttributesEnqueuedTask.taskUid,
1006-
);
1005+
await masterClient.waitForTask(taskUid);
10071006

1008-
const searchResponse = await localIndex.search('french', {
1007+
const searchResponse = await client.index(index.uid).search('french', {
10091008
locales: ['fra', 'eng'],
10101009
});
10111010

0 commit comments

Comments
 (0)