Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// @vitest-environment node
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
||||
const editorSource = readFileSync(path.join(moduleDir, "ui/editor/index.tsx"), "utf8");
|
||||
const extensionsSource = readFileSync(path.join(moduleDir, "ui/editor/extensions/index.tsx"), "utf8");
|
||||
const hookSource = readFileSync(path.join(moduleDir, "ui/editor/useHocuspocusProvider.ts"), "utf8");
|
||||
|
||||
describe("Novel editor — Hocuspocus integration", () => {
|
||||
it("disables StarterKit history when collab is active to avoid clashing with Y.js history", () => {
|
||||
expect(extensionsSource).toContain("history: starterKitHistory");
|
||||
// ensure history option is conditional on `collab`
|
||||
expect(extensionsSource).toMatch(/collab\s*\?\s*false\s*:/);
|
||||
});
|
||||
|
||||
it("only appends Collaboration + CollaborationCursor extensions when collab is provided", () => {
|
||||
expect(extensionsSource).toContain("Collaboration.configure");
|
||||
expect(extensionsSource).toContain("CollaborationCursor.configure");
|
||||
expect(extensionsSource).toMatch(/\.\.\.\(collab[\s\S]+?Collaboration\.configure/);
|
||||
});
|
||||
|
||||
it("exposes a typed collab prop on NovelEditor", () => {
|
||||
expect(editorSource).toContain("collab?: NovelEditorCollabOptions");
|
||||
expect(editorSource).toContain("export type NovelEditorCollabOptions");
|
||||
});
|
||||
|
||||
it("skips localStorage hydration when collab is active (Y.Doc is source of truth)", () => {
|
||||
expect(editorSource).toContain("if (collaborationConfig) {");
|
||||
});
|
||||
|
||||
it("renders a status banner while the provider is connecting / disconnected", () => {
|
||||
expect(editorSource).toContain("data-testid=\"novel-collab-status\"");
|
||||
});
|
||||
|
||||
it("provider hook returns null when url or token are missing — graceful degradation", () => {
|
||||
expect(hookSource).toContain("Boolean(url && token && documentName)");
|
||||
expect(hookSource).toContain("if (!enabled");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user