Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,65 @@
import { describe, expect, it } from "vitest";
import { createSearchClient } from "./client.js";
import { createSearchIndex } from "./index-helper.js";
import type { SearchIndexSchema } from "./schemas/index.js";
import { createInMemoryMeili } from "./testing.js";
/**
* A schema that carries stopWords + synonyms but deliberately omits
* rankingRules — exercises both the truthy (stopWords/synonyms) and the
* falsy (rankingRules) merge branches plus the synonyms copy helper.
*/
const schemaWithSynonyms: SearchIndexSchema = {
name: "syn-index",
primaryKey: "id",
searchableAttributes: ["title"],
filterableAttributes: ["tenantId"],
sortableAttributes: ["createdAt"],
stopWords: ["the", "a"],
synonyms: { car: ["auto", "vehicle"], laptop: ["notebook"] },
allowedDocumentFields: ["id", "tenantId", "title", "createdAt"],
};
describe("createSearchIndex — schema settings merge", () => {
it("forwards schema-level stopWords and synonyms, omitting absent rankingRules", async () => {
const { factory, state } = createInMemoryMeili();
const client = createSearchClient({ url: "http://memory", meiliFactory: factory });
await createSearchIndex({ client, schema: schemaWithSynonyms });
const settings = state.indexes.get("syn-index")?.settings;
expect(settings).toMatchObject({
searchableAttributes: ["title"],
stopWords: ["the", "a"],
synonyms: { car: ["auto", "vehicle"], laptop: ["notebook"] },
});
expect(settings).not.toHaveProperty("rankingRules");
});
it("lets each overridable field win over the schema value", async () => {
const { factory, state } = createInMemoryMeili();
const client = createSearchClient({ url: "http://memory", meiliFactory: factory });
await createSearchIndex({
client,
schema: schemaWithSynonyms,
settingsOverride: {
searchableAttributes: ["body"],
filterableAttributes: ["tenantId", "status"],
sortableAttributes: ["updatedAt"],
rankingRules: ["words", "sort"],
stopWords: ["und"],
synonyms: { x: ["y"] },
},
});
expect(state.indexes.get("syn-index")?.settings).toMatchObject({
searchableAttributes: ["body"],
filterableAttributes: ["tenantId", "status"],
sortableAttributes: ["updatedAt"],
rankingRules: ["words", "sort"],
stopWords: ["und"],
synonyms: { x: ["y"] },
});
});
});