diff --git a/src/hooks/useNoteActions.hook.test.ts b/src/hooks/useNoteActions.hook.test.ts index 123d3d7c..5d15a59d 100644 --- a/src/hooks/useNoteActions.hook.test.ts +++ b/src/hooks/useNoteActions.hook.test.ts @@ -327,7 +327,7 @@ describe('useNoteActions hook', () => { expect(createdEntry.isA).toBe('Project') }) - it('handleCreateNote uses default template for Project type', () => { + it('handleCreateNote leaves Project body empty without an explicit type template', () => { const { result } = renderHook(() => useNoteActions(makeConfig())) act(() => { @@ -335,8 +335,7 @@ describe('useNoteActions hook', () => { }) const tabContent = result.current.tabs[0].content - expect(tabContent).toContain('## Objective') - expect(tabContent).toContain('## Key Results') + expect(tabContent).toBe('---\ntitle: My Project\ntype: Project\n---\n') }) it('handleCreateNote uses custom template from type entry', () => { diff --git a/src/hooks/useNoteCreation.extra.test.ts b/src/hooks/useNoteCreation.extra.test.ts index 824803f6..e8c1b7c7 100644 --- a/src/hooks/useNoteCreation.extra.test.ts +++ b/src/hooks/useNoteCreation.extra.test.ts @@ -9,7 +9,6 @@ import { resolveNewNote, resolveNewType, planNewTypeCreation, - DEFAULT_TEMPLATES, resolveTemplate, } from './useNoteCreation' @@ -232,8 +231,8 @@ describe('resolveTemplate', () => { expect(resolveTemplate({ entries: [typeEntry], typeName: 'Recipe' })).toBe('## Ingredients\n\n## Steps\n\n') }) - it('falls back to DEFAULT_TEMPLATES for built-in types', () => { - expect(resolveTemplate({ entries: [], typeName: 'Project' })).toBe(DEFAULT_TEMPLATES.Project) + it('returns null for built-in types without an explicit type template', () => { + expect(resolveTemplate({ entries: [], typeName: 'Project' })).toBeNull() }) it('returns null when no template and no default', () => { @@ -246,15 +245,6 @@ describe('resolveTemplate', () => { }) }) -describe('DEFAULT_TEMPLATES', () => { - it('has templates for Project, Person, Responsibility, Experiment', () => { - expect(DEFAULT_TEMPLATES.Project).toBeDefined() - expect(DEFAULT_TEMPLATES.Person).toBeDefined() - expect(DEFAULT_TEMPLATES.Responsibility).toBeDefined() - expect(DEFAULT_TEMPLATES.Experiment).toBeDefined() - }) -}) - describe('resolveNewNote', () => { it('creates note at vault root', () => { const { entry, content } = resolveNewNote({ title: 'My Project', type: 'Project', vaultPath: '/my/vault' }) diff --git a/src/hooks/useNoteCreation.test.ts b/src/hooks/useNoteCreation.test.ts index 67780107..1616b948 100644 --- a/src/hooks/useNoteCreation.test.ts +++ b/src/hooks/useNoteCreation.test.ts @@ -13,7 +13,6 @@ import { resolveNewType, resolveTemplate, resolveTypeInstanceDefaults, - DEFAULT_TEMPLATES, RAPID_CREATE_NOTE_SETTLE_MS, planNewNoteCreation, useNoteCreation, @@ -284,8 +283,8 @@ describe('resolveTemplate', () => { expect(resolveTemplate({ entries: [typeEntry], typeName: 'Recipe' })).toBe('## Ingredients\n\n') }) - it('falls back to DEFAULT_TEMPLATES', () => { - expect(resolveTemplate({ entries: [], typeName: 'Project' })).toBe(DEFAULT_TEMPLATES.Project) + it('returns null for built-in types without an explicit type template', () => { + expect(resolveTemplate({ entries: [], typeName: 'Project' })).toBeNull() }) it('returns null when no template and no default', () => { @@ -473,7 +472,7 @@ describe('useNoteCreation hook', () => { }) expect(addEntry.mock.calls[0][0].isA).toBe('Project') expect(addEntry.mock.calls[0][0].status).toBeNull() - expect(openTabWithContent.mock.calls[0][1]).toBe('---\ntype: Project\n---\n\n# \n\n## Objective\n\n\n\n## Key Results\n\n\n\n## Notes\n\n') + expect(openTabWithContent.mock.calls[0][1]).toBe('---\ntype: Project\n---\n\n# \n\n') }) it('handleCreateNoteImmediate persists typed notes under Windows verbatim vault roots', async () => { diff --git a/src/hooks/useNoteCreation.ts b/src/hooks/useNoteCreation.ts index b9b39b42..a66e4cec 100644 --- a/src/hooks/useNoteCreation.ts +++ b/src/hooks/useNoteCreation.ts @@ -88,15 +88,7 @@ export function entryMatchesTarget({ entry, target }: EntryMatchParams): boolean return resolveEntry([entry], target) === entry } -/** Default templates for built-in types. Used when the type entry has no custom template. */ -export const DEFAULT_TEMPLATES: Record = { - Project: '## Objective\n\n\n\n## Key Results\n\n\n\n## Notes\n\n', - Person: '## Role\n\n\n\n## Contact\n\n\n\n## Notes\n\n', - Responsibility: '## Description\n\n\n\n## Key Activities\n\n\n\n## Notes\n\n', - Experiment: '## Hypothesis\n\n\n\n## Method\n\n\n\n## Results\n\n\n\n## Conclusion\n\n', -} - -/** Look up the template for a given type from the type entry or defaults. */ +/** Look up the template for a given type from the type entry. */ export interface TemplateLookupParams { entries: VaultEntry[] typeName: string @@ -104,7 +96,7 @@ export interface TemplateLookupParams { export function resolveTemplate({ entries, typeName }: TemplateLookupParams): string | null { const typeEntry = entries.find((entry) => entry.isA === 'Type' && entry.title === typeName) - return typeEntry?.template ?? (Reflect.get(DEFAULT_TEMPLATES, typeName) as string | undefined) ?? null + return typeEntry?.template ?? null } export interface NoteContentParams {