- Email hero: formatted period title, RECAP/CHECKPOINT badge, 2x2 stat grid, inline meta tags, greeting separated from title, no addHeading() - Checkpoint vs Recap distinction in subject, badge, and footer - Replace "Calendar pace" with Balance index in calendar_goals hero stats - Email chart blocks: Calendar split (pie as horizontal bars) and Day-of-week pattern for calendar_goals; adds Category split for category_and_calendar_goals; charts data pre-aggregated in ReportSummaryService.buildChartData() with per-weekday DOW averages - Fix: days_off no longer counts future dates in the period as quiet days - Fix: detectTimeSummaryDisplayMode and detectTargetsDisplayMode now always return the strategy-mapped mode when strategy is set, preventing stale categories config from overriding a known onboarding strategy - Fix: resolveTodayGroups filters today groups by active display mode - Add Checkpoint and Recap test-send buttons to onboarding Preferences; test sends now always use offset=-1 (recap) or offset=0 (checkpoint)
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
|
|
import { createDefaultWidgetTabs } from '../src/services/widgetsRegistry'
|
|
import { setWidgetPresets } from '../src/services/widgetDefaults'
|
|
|
|
describe('widget defaults', () => {
|
|
it('includes deck stats in the standard preset when server presets are loaded', () => {
|
|
setWidgetPresets({
|
|
quick: [],
|
|
standard: [
|
|
{
|
|
id: 'widget-deck_stats-1',
|
|
type: 'deck_stats',
|
|
options: {},
|
|
layout: { width: 'half', height: 'm', order: 45 },
|
|
version: 1,
|
|
},
|
|
],
|
|
pro: [],
|
|
})
|
|
|
|
const tabs = createDefaultWidgetTabs('standard')
|
|
|
|
expect(tabs.tabs).toHaveLength(1)
|
|
expect(tabs.tabs[0].widgets.some((widget) => widget.type === 'deck_stats')).toBe(true)
|
|
})
|
|
|
|
it('includes deck stats in the advanced Workspace tab', () => {
|
|
const tabs = createDefaultWidgetTabs('pro')
|
|
const workspaceTab = tabs.tabs.find((tab) => tab.label === 'Workspace')
|
|
|
|
expect(workspaceTab).toBeTruthy()
|
|
expect(workspaceTab?.widgets.some((widget) => widget.type === 'deck_stats')).toBe(true)
|
|
})
|
|
|
|
it('aligns strategy-owned widget options when creating defaults for calendar goals', () => {
|
|
const tabs = createDefaultWidgetTabs('pro', 'total_plus_categories')
|
|
const overview = tabs.tabs.flatMap((tab) => tab.widgets).find((widget) => widget.type === 'time_summary_overview')
|
|
|
|
expect(overview?.options?.showCalendarSummary).toBe(true)
|
|
expect(overview?.options?.showTopCategory).toBe(false)
|
|
expect(overview?.options?.showBalance).toBe(false)
|
|
})
|
|
})
|