Enhance interview configuration and wizard functionality
- Added parsing for new edging configuration options in interview profiles, including mode, wrapper callout type, title, and folded state. - Updated the InterviewWizardModal to support post-run edging, allowing for semantic mapping based on the new edging settings. - Enhanced the unresolved link handler to pass plugin instance and settings for improved graph schema loading and post-run edging functionality. - Improved error handling and user notifications for semantic mapping processes, ensuring better feedback during execution.
This commit is contained in:
1 parent
a6ce268b04
commit
5ed06e6b9a
6 files changed
+263
-6
No files matched your search
@@ -0,0 +1,142 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import type { InterviewProfile } from "../../interview/types";
|
||||
|
||||
describe("Post-run edging integration", () => {
|
||||
let mockApp: any;
|
||||
let mockFile: any;
|
||||
let mockSettings: any;
|
||||
let mockBuildSemanticMappings: any;
|
||||
|
||||
beforeEach(() => {
|
||||
mockApp = {
|
||||
vault: {
|
||||
read: vi.fn().mockResolvedValue("Content"),
|
||||
},
|
||||
};
|
||||
mockFile = {
|
||||
path: "test.md",
|
||||
basename: "test",
|
||||
};
|
||||
mockSettings = {
|
||||
mappingWrapperCalloutType: "abstract",
|
||||
mappingWrapperTitle: "🕸️ Semantic Mapping",
|
||||
mappingWrapperFolded: true,
|
||||
unassignedHandling: "prompt",
|
||||
allowOverwriteExistingMappings: false,
|
||||
};
|
||||
mockBuildSemanticMappings = vi.fn().mockResolvedValue({
|
||||
sectionsProcessed: 2,
|
||||
sectionsWithMappings: 2,
|
||||
totalLinks: 5,
|
||||
existingMappingsKept: 3,
|
||||
newMappingsAssigned: 2,
|
||||
unmappedLinksSkipped: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it("should invoke builder when profile has edging.mode=post_run", async () => {
|
||||
const profile: InterviewProfile = {
|
||||
key: "test-profile",
|
||||
label: "Test Profile",
|
||||
note_type: "note",
|
||||
steps: [],
|
||||
edging: {
|
||||
mode: "post_run",
|
||||
},
|
||||
};
|
||||
|
||||
// This is a unit test for the hook path
|
||||
// In real implementation, this would be called from InterviewWizardModal
|
||||
const shouldRunEdging = profile.edging?.mode === "post_run";
|
||||
expect(shouldRunEdging).toBe(true);
|
||||
});
|
||||
|
||||
it("should not invoke builder when profile has edging.mode=none", () => {
|
||||
const profile: InterviewProfile = {
|
||||
key: "test-profile",
|
||||
label: "Test Profile",
|
||||
note_type: "note",
|
||||
steps: [],
|
||||
edging: {
|
||||
mode: "none",
|
||||
},
|
||||
};
|
||||
|
||||
const shouldRunEdging = profile.edging?.mode === "post_run";
|
||||
expect(shouldRunEdging).toBe(false);
|
||||
});
|
||||
|
||||
it("should not invoke builder when profile has no edging config", () => {
|
||||
const profile: InterviewProfile = {
|
||||
key: "test-profile",
|
||||
label: "Test Profile",
|
||||
note_type: "note",
|
||||
steps: [],
|
||||
};
|
||||
|
||||
const shouldRunEdging = profile.edging?.mode === "post_run";
|
||||
expect(shouldRunEdging).toBe(false);
|
||||
});
|
||||
|
||||
it("should use profile edging config over settings", () => {
|
||||
const profile: InterviewProfile = {
|
||||
key: "test-profile",
|
||||
label: "Test Profile",
|
||||
note_type: "note",
|
||||
steps: [],
|
||||
edging: {
|
||||
mode: "post_run",
|
||||
wrapperCalloutType: "info",
|
||||
wrapperTitle: "Custom Title",
|
||||
wrapperFolded: false,
|
||||
},
|
||||
};
|
||||
|
||||
const settings = {
|
||||
mappingWrapperCalloutType: "abstract",
|
||||
mappingWrapperTitle: "Default Title",
|
||||
mappingWrapperFolded: true,
|
||||
};
|
||||
|
||||
// Profile config should override settings
|
||||
const finalCalloutType = profile.edging?.wrapperCalloutType || settings.mappingWrapperCalloutType;
|
||||
const finalTitle = profile.edging?.wrapperTitle || settings.mappingWrapperTitle;
|
||||
const finalFolded = profile.edging?.wrapperFolded !== undefined
|
||||
? profile.edging.wrapperFolded
|
||||
: settings.mappingWrapperFolded;
|
||||
|
||||
expect(finalCalloutType).toBe("info");
|
||||
expect(finalTitle).toBe("Custom Title");
|
||||
expect(finalFolded).toBe(false);
|
||||
});
|
||||
|
||||
it("should use settings defaults when profile edging config is partial", () => {
|
||||
const profile: InterviewProfile = {
|
||||
key: "test-profile",
|
||||
label: "Test Profile",
|
||||
note_type: "note",
|
||||
steps: [],
|
||||
edging: {
|
||||
mode: "post_run",
|
||||
wrapperCalloutType: "info",
|
||||
// wrapperTitle and wrapperFolded not specified
|
||||
},
|
||||
};
|
||||
|
||||
const settings = {
|
||||
mappingWrapperCalloutType: "abstract",
|
||||
mappingWrapperTitle: "Default Title",
|
||||
mappingWrapperFolded: true,
|
||||
};
|
||||
|
||||
const finalCalloutType = profile.edging?.wrapperCalloutType || settings.mappingWrapperCalloutType;
|
||||
const finalTitle = profile.edging?.wrapperTitle || settings.mappingWrapperTitle;
|
||||
const finalFolded = profile.edging?.wrapperFolded !== undefined
|
||||
? profile.edging.wrapperFolded
|
||||
: settings.mappingWrapperFolded;
|
||||
|
||||
expect(finalCalloutType).toBe("info"); // From profile
|
||||
expect(finalTitle).toBe("Default Title"); // From settings (fallback)
|
||||
expect(finalFolded).toBe(true); // From settings (fallback)
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user