Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,63 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import * as search from "./index.js";
|
||||
|
||||
/**
|
||||
* The barrel is the package's public contract: every name listed in the
|
||||
* code-review checklist must stay re-exported, and the raw Meilisearch SDK
|
||||
* must never leak through it. These tests pin both invariants so an
|
||||
* accidental re-export removal (or a stray `MeiliSearch` export) fails CI.
|
||||
*/
|
||||
describe("@hivegrid/search public barrel", () => {
|
||||
it("re-exports the documented runtime API", () => {
|
||||
const expected = [
|
||||
"createSearchClient",
|
||||
"createSearchIndex",
|
||||
"IndexSchemaValidationError",
|
||||
"validateIndexSchema",
|
||||
"bulkIndex",
|
||||
"deleteFromIndex",
|
||||
"health",
|
||||
"searchInIndex",
|
||||
"searchWithFallback",
|
||||
"TenantScopeError",
|
||||
"ALL_SEARCH_INDEXES",
|
||||
"BULK_REINDEX_SUPPORTED_INDEXES",
|
||||
"BULK_REINDEX_SUPPORTED_INDEX_NAMES",
|
||||
"crmContactsIndex",
|
||||
"getSearchIndexSchema",
|
||||
"kbArticlesIndex",
|
||||
"usersIndex",
|
||||
"getIndexedEntitiesForPermissions",
|
||||
"getIndexedEntity",
|
||||
"indexedEntities",
|
||||
"listIndexedEntities",
|
||||
"validateIndexedEntities",
|
||||
"sanitizeDocument",
|
||||
"publishSearchBulkReindexEvent",
|
||||
"publishSearchDeleteEvent",
|
||||
"publishSearchUpsertEvent",
|
||||
"searchEventType",
|
||||
] as const;
|
||||
|
||||
for (const name of expected) {
|
||||
expect(search, `missing export: ${name}`).toHaveProperty(name);
|
||||
expect(search[name as keyof typeof search]).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("does not leak the raw Meilisearch SDK constructor", () => {
|
||||
expect(search).not.toHaveProperty("MeiliSearch");
|
||||
expect(search).not.toHaveProperty("Meilisearch");
|
||||
});
|
||||
|
||||
it("wires the error classes as constructable Error subclasses", () => {
|
||||
expect(new search.TenantScopeError("nope")).toBeInstanceOf(Error);
|
||||
expect(new search.IndexSchemaValidationError("nope", "EMPTY_NAME")).toBeInstanceOf(Error);
|
||||
});
|
||||
|
||||
it("keeps the index registry consistent between the barrel and schemas", () => {
|
||||
expect(search.ALL_SEARCH_INDEXES).toContain(search.kbArticlesIndex);
|
||||
expect(search.getSearchIndexSchema(search.kbArticlesIndex.name)).toBe(search.kbArticlesIndex);
|
||||
expect(search.getSearchIndexSchema("does-not-exist")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user