Skip to content

Commit

Permalink
Make test more consistent with the rest, add locales type to SearchRe…
Browse files Browse the repository at this point in the history
…questGET
  • Loading branch information
flevi29 committed Aug 21, 2024
1 parent d44a2d6 commit 238200b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export type HybridSearch = {
semanticRatio?: number;
};

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

export type SearchParams = Query &
Expand Down Expand Up @@ -156,6 +156,7 @@ export type SearchRequestGET = Pagination &
rankingScoreThreshold?: number;
distinct?: string;
retrieveVectors?: boolean;
locales?: Locale[];
};

export type MultiSearchQuery = SearchParams & { indexUid: string };
Expand Down
17 changes: 8 additions & 9 deletions tests/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,19 +993,18 @@ describe.each([
).rejects.toHaveProperty('cause.code', ErrorStatusCode.INDEX_NOT_FOUND);
});

test(`${permission} key: Search with locales`, async () => {
const localIndex = (await getClient(permission)).index(index.uid);
const localMasterIndex = (await getClient('Master')).index(index.uid);
test.only(`${permission} key: Search with locales`, async () => {

Check failure on line 996 in tests/search.test.ts

View workflow job for this annotation

GitHub Actions / style-check

Unexpected focused test
const client = await getClient(permission);
const masterClient = await getClient('Master');

const updateLocalizedAttributesEnqueuedTask =
await localMasterIndex.updateLocalizedAttributes([
const { taskUid } = await masterClient
.index(index.uid)
.updateLocalizedAttributes([
{ attributePatterns: ['title', 'comment'], locales: ['fra', 'eng'] },
]);
await localMasterIndex.waitForTask(
updateLocalizedAttributesEnqueuedTask.taskUid,
);
await masterClient.waitForTask(taskUid);

const searchResponse = await localIndex.search('french', {
const searchResponse = await client.index(index.uid).search('french', {
locales: ['fra', 'eng'],
});

Expand Down

0 comments on commit 238200b

Please sign in to comment.