fix: show type-derived instance property placeholders

This commit is contained in:
lucaronin
2026-05-04 10:45:49 +02:00
parent 3c483ba0e6
commit ebf4545d46
15 changed files with 946 additions and 103 deletions

View File

@@ -12,6 +12,7 @@ import {
resolveNewNote,
resolveNewType,
resolveTemplate,
resolveTypeInstanceDefaults,
DEFAULT_TEMPLATES,
RAPID_CREATE_NOTE_SETTLE_MS,
planNewNoteCreation,
@@ -171,6 +172,33 @@ describe('resolveNewNote', () => {
expect(content).not.toContain('status:')
})
it('applies valued properties and relationships from the type entry to newly created instances', () => {
const typeEntry = makeEntry({
title: 'Book',
isA: 'Type',
properties: {
Rating: 5,
'start date': null,
},
relationships: {
Author: ['[[person/frank-herbert]]'],
},
})
const defaults = resolveTypeInstanceDefaults({ entries: [typeEntry], typeName: 'Book' })
const { entry, content } = resolveNewNote({
title: 'Dune',
type: 'Book',
vaultPath: '/vault',
defaults,
})
expect(content).toContain('Rating: 5')
expect(content).toContain('Author: "[[person/frank-herbert]]"')
expect(content).not.toContain('start date:')
expect(entry.properties).toEqual({ Rating: 5 })
expect(entry.relationships).toEqual({ Author: ['[[person/frank-herbert]]'] })
})
it('blocks creation when macOS /tmp aliases point at the same note path', () => {
const plan = planNewNoteCreation({
entries: [makeEntry({ path: '/private/tmp/tolaria-vault/briefing.md', filename: 'briefing.md' })],