2026-05-04 19:00:09 +02:00
|
|
|
import { describe, expect, it } from 'vitest'
|
2026-05-05 00:20:33 +02:00
|
|
|
import { createMobileNoteFile, normalizeMobileNoteCreateTitle } from './mobileNoteCreate'
|
2026-05-04 19:00:09 +02:00
|
|
|
|
|
|
|
|
describe('mobile note create', () => {
|
|
|
|
|
it('creates a deterministic markdown file from the current time', () => {
|
|
|
|
|
const file = createMobileNoteFile({
|
|
|
|
|
now: new Date('2026-05-04T12:34:56.000Z'),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(file).toEqual({
|
|
|
|
|
path: 'note-mor6mem8.md',
|
|
|
|
|
content: [
|
|
|
|
|
'---',
|
|
|
|
|
'title: Untitled',
|
|
|
|
|
'type: Note',
|
|
|
|
|
'created: 2026-05-04T12:34:56.000Z',
|
|
|
|
|
'---',
|
|
|
|
|
'',
|
|
|
|
|
'# Untitled',
|
|
|
|
|
'',
|
|
|
|
|
].join('\n'),
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('supports a custom title for future create flows', () => {
|
|
|
|
|
const file = createMobileNoteFile({
|
|
|
|
|
now: new Date('2026-05-04T12:34:56.000Z'),
|
|
|
|
|
title: 'Meeting notes',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(file.content).toContain('title: Meeting notes')
|
|
|
|
|
expect(file.content).toContain('# Meeting notes')
|
|
|
|
|
})
|
2026-05-05 00:20:33 +02:00
|
|
|
|
|
|
|
|
it('normalizes blank and padded create titles', () => {
|
|
|
|
|
expect(normalizeMobileNoteCreateTitle(' Meeting notes ')).toBe('Meeting notes')
|
|
|
|
|
expect(normalizeMobileNoteCreateTitle(' ')).toBe('Untitled')
|
|
|
|
|
})
|
2026-05-04 19:00:09 +02:00
|
|
|
})
|