Files
tolaria/src/utils/frontmatter.test.ts
lucaronin 4c7e64dc0c fix: bump cache version + handle Yes/No in TS frontmatter parser
Root cause: commit d6d35b3 added a custom Rust deserializer for
Archived/Trashed Yes/No strings but did not bump CACHE_VERSION.
Existing vaults had stale cached entries with archived: false from the
old parser, and since the cache version (5) matched, stale values were
served without re-parsing from disk.

- Bump CACHE_VERSION 5 → 6 to force full rescan on next vault load
- Add Yes/No handling to TypeScript parseScalar (Inspector display)
- Add integration tests: cached vault path with Archived/Trashed: Yes
- Add stale cache version invalidation test
- Add frontmatter.test.ts for TS Yes/No boolean parsing
- Add Playwright smoke test for archived note filtering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:07:22 +01:00

47 lines
1.4 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { parseFrontmatter } from './frontmatter'
describe('parseFrontmatter', () => {
describe('boolean-like Yes/No values', () => {
it('parses Archived: Yes as true', () => {
const fm = parseFrontmatter('---\nArchived: Yes\n---\nBody')
expect(fm['Archived']).toBe(true)
})
it('parses Archived: No as false', () => {
const fm = parseFrontmatter('---\nArchived: No\n---\nBody')
expect(fm['Archived']).toBe(false)
})
it('parses Trashed: Yes as true', () => {
const fm = parseFrontmatter('---\nTrashed: Yes\n---\nBody')
expect(fm['Trashed']).toBe(true)
})
it('parses Trashed: No as false', () => {
const fm = parseFrontmatter('---\nTrashed: No\n---\nBody')
expect(fm['Trashed']).toBe(false)
})
it('parses yes (lowercase) as true', () => {
const fm = parseFrontmatter('---\nArchived: yes\n---\nBody')
expect(fm['Archived']).toBe(true)
})
it('parses no (lowercase) as false', () => {
const fm = parseFrontmatter('---\nArchived: no\n---\nBody')
expect(fm['Archived']).toBe(false)
})
it('still parses true as true', () => {
const fm = parseFrontmatter('---\nArchived: true\n---\nBody')
expect(fm['Archived']).toBe(true)
})
it('still parses false as false', () => {
const fm = parseFrontmatter('---\nArchived: false\n---\nBody')
expect(fm['Archived']).toBe(false)
})
})
})