Add semantic mapping builder functionality and settings
- Introduced a new command to build semantic mapping blocks by section, including user prompts for overwriting existing mappings. - Enhanced settings interface with options for mapping wrapper type, title, folded state, default edge type, unassigned handling, and overwrite permissions. - Implemented virtualization in the EntityPickerModal for improved performance when displaying large sets of entries, including scroll handling and item rendering optimizations. - Updated UI components to reflect new settings and functionalities, ensuring a cohesive user experience.
This commit is contained in:
1 parent
78e8216ab9
commit
58b6ffffed
18 files changed
+2148
-7
No files matched your search
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Unit tests for section parser.
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { splitIntoSections, extractWikilinks } from "../../mapping/sectionParser";
|
||||
|
||||
describe("splitIntoSections", () => {
|
||||
it("should split note with multiple headings", () => {
|
||||
const markdown = `# Heading 1
|
||||
|
||||
Content with [[Link1]] and [[Link2]].
|
||||
|
||||
## Heading 2
|
||||
|
||||
More content with [[Link3]].
|
||||
|
||||
### Heading 3
|
||||
|
||||
Even more content.
|
||||
`;
|
||||
|
||||
const sections = splitIntoSections(markdown);
|
||||
|
||||
expect(sections).toHaveLength(4);
|
||||
expect(sections[0]?.heading).toBeNull();
|
||||
expect(sections[0]?.headingLevel).toBe(0);
|
||||
expect(sections[1]?.heading).toBe("Heading 1");
|
||||
expect(sections[1]?.headingLevel).toBe(1);
|
||||
expect(sections[2]?.heading).toBe("Heading 2");
|
||||
expect(sections[2]?.headingLevel).toBe(2);
|
||||
expect(sections[3]?.heading).toBe("Heading 3");
|
||||
expect(sections[3]?.headingLevel).toBe(3);
|
||||
});
|
||||
|
||||
it("should extract links per section", () => {
|
||||
const markdown = `# Section 1
|
||||
|
||||
Content with [[Link1]] and [[Link2]].
|
||||
|
||||
## Section 2
|
||||
|
||||
More content with [[Link3]].
|
||||
`;
|
||||
|
||||
const sections = splitIntoSections(markdown);
|
||||
|
||||
expect(sections[1]?.links).toContain("Link1");
|
||||
expect(sections[1]?.links).toContain("Link2");
|
||||
expect(sections[2]?.links).toContain("Link3");
|
||||
expect(sections[2]?.links).not.toContain("Link1");
|
||||
});
|
||||
|
||||
it("should handle note without headings", () => {
|
||||
const markdown = `Content with [[Link1]] and [[Link2]].`;
|
||||
|
||||
const sections = splitIntoSections(markdown);
|
||||
|
||||
expect(sections).toHaveLength(1);
|
||||
expect(sections[0]?.heading).toBeNull();
|
||||
expect(sections[0]?.links).toContain("Link1");
|
||||
expect(sections[0]?.links).toContain("Link2");
|
||||
});
|
||||
});
|
||||
|
||||
describe("extractWikilinks", () => {
|
||||
it("should extract and deduplicate wikilinks", () => {
|
||||
const markdown = `Content with [[Link1]], [[Link2]], and [[Link1]] again.`;
|
||||
|
||||
const links = extractWikilinks(markdown);
|
||||
|
||||
expect(links).toHaveLength(2);
|
||||
expect(links).toContain("Link1");
|
||||
expect(links).toContain("Link2");
|
||||
});
|
||||
|
||||
it("should handle empty content", () => {
|
||||
const links = extractWikilinks("");
|
||||
expect(links).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user