servicesEntryBoundary.test.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. import { describe, expect, it } from "vitest";
  2. describe("services package entry boundaries", () => {
  3. it("keeps conversation-share runtime implementations out of the browser-safe root entry", async () => {
  4. const browserSafeEntry = await import("@zcode/services");
  5. expect(browserSafeEntry.IConversationShareService).toBeDefined();
  6. expect(browserSafeEntry.ConversationShareServiceError).toBeDefined();
  7. expect(browserSafeEntry).not.toHaveProperty("ConversationShareService");
  8. expect(browserSafeEntry).not.toHaveProperty("ConversationShareHttpClient");
  9. });
  10. it("exposes conversation-share runtime implementations from the node entry", async () => {
  11. const nodeEntry = await import("@zcode/services/node");
  12. expect(nodeEntry.ConversationShareService).toBeDefined();
  13. expect(nodeEntry.ConversationShareHttpClient).toBeDefined();
  14. });
  15. it("keeps the conversation-share test double out of both published entries", async () => {
  16. // Mock 只服务单测;一旦被 re-export 就会随 @zcode/services 进入桌面端产物。
  17. const [browserSafeEntry, nodeEntry] = await Promise.all([
  18. import("@zcode/services"),
  19. import("@zcode/services/node"),
  20. ]);
  21. expect(browserSafeEntry).not.toHaveProperty("ConversationShareMockApiClient");
  22. expect(nodeEntry).not.toHaveProperty("ConversationShareMockApiClient");
  23. });
  24. });