Files
MindSift/frontend/src/lib/__tests__/journal.test.ts
T
sandrodachandClaude Opus 5.5 9008d7c915
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m6s
feat(workspace): journal with one note per day and a calendar
- journal_days (migration 8) maps a person's day to an ordinary note;
  GET /journal lists the days, POST /journal/{date} opens or creates one
- the journal sits on top of the notes sidebar: days below each other
  (today first, older ones load while scrolling), a calendar with month
  and year picker follows the day in view and jumps to any day
- the header shares the day in view; journal notes stay out of the folder
  tree; can be switched off per device under Darstellung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 19:20:58 +01:00

17 lines
626 B
TypeScript

import { describe, it, expect } from 'vitest';
import { monthGrid, toISODate, parseISODate } from '../journal';
describe('journal dates', () => {
it('builds a Monday-first month grid', () => {
// October 2026 starts on a Thursday
const weeks = monthGrid(2026, 9);
expect(weeks[0]).toEqual([null, null, null, '2026-10-01', '2026-10-02', '2026-10-03', '2026-10-04']);
expect(weeks.flat().filter(Boolean)).toHaveLength(31);
expect(weeks.every((w) => w.length === 7)).toBe(true);
});
it('round-trips local dates', () => {
expect(toISODate(parseISODate('2026-03-01'))).toBe('2026-03-01');
});
});