2026-05-05 00:58:50 +02:00
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
import { readMobileNoteFrontmatter } from './mobileNoteFrontmatter'
|
|
|
|
|
|
|
|
|
|
describe('mobile note frontmatter', () => {
|
|
|
|
|
it('reads supported scalar note metadata', () => {
|
|
|
|
|
expect(readMobileNoteFrontmatter([
|
|
|
|
|
'---',
|
|
|
|
|
'type: Essay',
|
|
|
|
|
'icon: pen-nib',
|
2026-05-05 10:48:17 +02:00
|
|
|
'status: Active',
|
2026-05-05 00:58:50 +02:00
|
|
|
'date: "2026-05-05"',
|
|
|
|
|
'---',
|
|
|
|
|
'# Workflow',
|
|
|
|
|
].join('\n'))).toEqual({
|
|
|
|
|
date: '2026-05-05',
|
|
|
|
|
icon: 'pen-nib',
|
2026-05-05 10:48:17 +02:00
|
|
|
status: 'Active',
|
2026-05-05 00:58:50 +02:00
|
|
|
tags: [],
|
|
|
|
|
type: 'Essay',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('reads inline tag lists', () => {
|
|
|
|
|
expect(readMobileNoteFrontmatter('---\ntags: [Tolaria MVP, "mobile"]\n---\n# Note')).toEqual({
|
|
|
|
|
date: undefined,
|
|
|
|
|
icon: undefined,
|
2026-05-05 10:48:17 +02:00
|
|
|
status: undefined,
|
2026-05-05 00:58:50 +02:00
|
|
|
tags: ['Tolaria MVP', 'mobile'],
|
|
|
|
|
type: undefined,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('returns empty metadata when frontmatter is missing', () => {
|
|
|
|
|
expect(readMobileNoteFrontmatter('# Note')).toEqual({
|
|
|
|
|
date: undefined,
|
|
|
|
|
icon: undefined,
|
2026-05-05 10:48:17 +02:00
|
|
|
status: undefined,
|
2026-05-05 00:58:50 +02:00
|
|
|
tags: [],
|
|
|
|
|
type: undefined,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|